1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
import QtGraphicalEffects 1.0
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
Button {
id: _rootButton
property bool setupComplete: true ///< true: setup complete indicator shows as completed
property bool setupIndicator: true ///< true: show setup complete indicator
property string imageResource: "/qmlimages/subMenuButtonImage.png" ///< Button image
property size sourceSize: Qt.size(ScreenTools.defaultFontPixelHeight * 2, ScreenTools.defaultFontPixelHeight * 2)
text: "Button" ///< Pass in your own button text
checkable: true
implicitHeight: ScreenTools.isTinyScreen ? ScreenTools.defaultFontPixelHeight * 3.5 : ScreenTools.defaultFontPixelHeight * 2.5
implicitWidth: __panel.implicitWidth
style: ButtonStyle {
id: buttonStyle
QGCPalette {
id: qgcPal
colorGroupEnabled: control.enabled
}
property bool showHighlight: control.pressed | control.checked
background: Rectangle {
id: innerRect
color: showHighlight ? qgcPal.buttonHighlight : qgcPal.windowShade
implicitWidth: titleBar.x + titleBar.contentWidth + ScreenTools.defaultFontPixelWidth
QGCColoredImage {
id: image
anchors.leftMargin: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
width: ScreenTools.defaultFontPixelHeight * 2
height: ScreenTools.defaultFontPixelHeight * 2
fillMode: Image.PreserveAspectFit
mipmap: true
color: control.setupComplete ? qgcPal.button : "red"
source: control.imageResource
sourceSize: _rootButton.sourceSize
}
QGCLabel {
id: titleBar
anchors.leftMargin: ScreenTools.defaultFontPixelWidth
anchors.left: image.right
anchors.verticalCenter: parent.verticalCenter
verticalAlignment: TextEdit.AlignVCenter
color: showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText
text: control.text
}
}
label: Item {}
}
}