Debian Codegraph @

src/GUI/qml/AddButton.qml

raw
1 import QtQuick 2.4
2 import FlightGear 1.0
3
4 Rectangle {
5 id: root
6
7 property bool enabled: true
8 signal clicked
9
10 width: label.implicitWidth + height + Style.margin
11 height: icon.implicitHeight + 1
12 radius: Style.roundRadius
13
14 color: enabled ? (mouse.containsMouse ? Style.activeColor : Style.themeColor) : Style.disabledThemeColor
15
16 Text {
17 id: label
18 text: qsTr("Add")
19 color: Style.themeContrastTextColor
20
21 anchors {
22 left: parent.left
23 leftMargin: Style.margin
24 verticalCenter: parent.verticalCenter
25 }
26 font.pixelSize: Style.baseFontPixelSize
27 }
28
29 Image {
30 id: icon
31 anchors.right: parent.right
32 source: "image://colored-icon/add?themeContrast"
33 }
34
35 MouseArea {
36 id: mouse
37 anchors.fill: parent
38 enabled: root.enabled
39 hoverEnabled: true
40
41 onClicked: {
42 root.clicked();
43 }
44
45 }
46 }