Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
cde3cda1
Commit
cde3cda1
authored
Feb 24, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added menu support to QGCButton
parent
fd6b895b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
0 deletions
+95
-0
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-0
QGCButton.qml
src/QmlControls/QGCButton.qml
+63
-0
QmlTest.qml
src/QmlControls/QmlTest.qml
+31
-0
arrow-down.png
src/QmlControls/arrow-down.png
+0
-0
No files found.
qgroundcontrol.qrc
View file @
cde3cda1
...
...
@@ -253,6 +253,7 @@
<file alias="QGroundControl/Controls/QGCCheckBox.qml">src/QmlControls/QGCCheckBox.qml</file>
<file alias="QGroundControl/Controls/QGCLabel.qml">src/QmlControls/QGCLabel.qml</file>
<file alias="QGroundControl/Controls/QGCTextField.qml">src/QmlControls/QGCTextField.qml</file>
<file alias="QGroundControl/Controls/arrow-down.png">src/QmlControls/arrow-down.png</file>
<file alias="octo_x.png">files/images/px4/airframes/octo_x.png</file>
<file alias="px4fmu_2.x.png">files/images/px4/boards/px4fmu_2.x.png</file>
...
...
src/QmlControls/QGCButton.qml
View file @
cde3cda1
import
QtQuick
2.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QtQuick
.
Controls
.
Private
1.0
import
QGroundControl
.
Palette
1.0
...
...
@@ -13,6 +14,7 @@ Button {
property
bool
__showHighlight
:
pressed
|
hovered
|
checked
style
:
ButtonStyle
{
/*
background: Rectangle {
implicitWidth: 100
implicitHeight: 25
...
...
@@ -33,5 +35,66 @@ Button {
control.__qgcPal.buttonHighlightText :
(primary ? control.__qgcPal.primaryButtonText : control.__qgcPal.buttonText)
}
*/
/*! The padding between the background and the label components. */
padding
{
top
:
4
left
:
4
right
:
control
.
menu
!==
null
?
Math
.
round
(
TextSingleton
.
implicitHeight
*
0.5
)
:
4
bottom
:
4
}
/*! This defines the background of the button. */
background
:
Item
{
property
bool
down
:
control
.
pressed
||
(
control
.
checkable
&&
control
.
checked
)
implicitWidth
:
Math
.
round
(
TextSingleton
.
implicitHeight
*
4.5
)
implicitHeight
:
Math
.
max
(
25
,
Math
.
round
(
TextSingleton
.
implicitHeight
*
1.2
))
Rectangle
{
anchors.fill
:
parent
color
:
__showHighlight
?
control
.
__qgcPal
.
buttonHighlight
:
(
primary
?
control
.
__qgcPal
.
primaryButton
:
control
.
__qgcPal
.
button
)
}
Image
{
id
:
imageItem
visible
:
control
.
menu
!==
null
source
:
"
arrow-down.png
"
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.right
:
parent
.
right
anchors.rightMargin
:
padding
.
right
opacity
:
control
.
enabled
?
0.6
:
0.5
}
}
/*! This defines the label of the button. */
label
:
Item
{
implicitWidth
:
row
.
implicitWidth
implicitHeight
:
row
.
implicitHeight
baselineOffset
:
row
.
y
+
text
.
y
+
text
.
baselineOffset
Row
{
id
:
row
anchors.centerIn
:
parent
spacing
:
2
Image
{
source
:
control
.
iconSource
anchors.verticalCenter
:
parent
.
verticalCenter
}
Text
{
id
:
text
renderType
:
Text
.
NativeRendering
anchors.verticalCenter
:
parent
.
verticalCenter
text
:
control
.
text
color
:
__showHighlight
?
control
.
__qgcPal
.
buttonHighlightText
:
(
primary
?
control
.
__qgcPal
.
primaryButtonText
:
control
.
__qgcPal
.
buttonText
)
}
}
}
}
}
src/QmlControls/QmlTest.qml
View file @
cde3cda1
...
...
@@ -367,6 +367,37 @@ Rectangle {
enabled
:
false
}
// QGCButton - menu
Loader
{
sourceComponent
:
ctlRowHeader
property
var
text
:
"
QGCButton(menu)
"
}
Menu
{
id
:
buttonMenu
MenuItem
{
text
:
"
Item 1
"
}
MenuItem
{
text
:
"
Item 2
"
}
MenuItem
{
text
:
"
Item 3
"
}
}
QGCButton
{
width
:
100
height
:
20
text
:
"
Button
"
menu
:
buttonMenu
}
QGCButton
{
width
:
100
height
:
20
text
:
"
Button
"
enabled
:
false
menu
:
buttonMenu
}
// QGCRadioButton
Loader
{
sourceComponent
:
ctlRowHeader
...
...
src/QmlControls/arrow-down.png
0 → 100644
View file @
cde3cda1
184 Bytes
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment