Debian Codegraph @

src/GUI/qml/GettingStartedTipDisplay.qml

raw
1 import QtQuick 2.4
2 import QtQml 2.4
3 import FlightGear 1.0
4
5 Item {
6 id: root
7
8 width: 100
9 height: 100
10
11 property GettingStartedController controller: null
12
13 property rect contentGeom: controller.contentGeometry
14 property rect tipGeom: controller.tipGeometry
15
16 // pass the tip height into the controller, when it's valid
17 Binding {
18 target: controller
19 property: "activeTipHeight"
20 value: contentBox.height
21 }
22
23 // the visible tip box
24 TipBackgroundBox {
25 id: tipBox
26
27 fill: Style.themeColor
28 borderWidth: 1
29 borderColor: Qt.darker(Style.themeColor)
30
31 x: tipGeom.x
32 y: tipGeom.y
33 width: tipGeom.width
34 height: tipGeom.height
35 arrow: controller.tip.arrow
36
37 Item {
38 id: contentBox
39 x: contentGeom.x
40 y: contentGeom.y
41 width: contentGeom.width
42 height: tipText.height + closeText.height + (Style.margin * 3)
43
44 Text {
45 id: tipText
46
47 font.pixelSize: Style.subHeadingFontPixelSize
48 color: Style.themeContrastTextColor
49
50 anchors {
51 top: parent.top
52 left: parent.left
53 right: parent.right
54 margins: Style.margin
55 }
56
57 // size this to the text, after wrapping
58 height: implicitHeight
59
60 text: controller.tip.text
61 wrapMode: Text.WordWrap
62 }
63
64 Text {
65 anchors {
66 margins: Style.margin
67 left: parent.left
68 top: tipText.bottom
69 }
70
71 text: "<"
72 color: prevMouseArea.containsMouse ? Style.themeContrastLinkColor : Style.themeContrastTextColor
73 visible: (controller.index > 0)
74 MouseArea {
75 id: prevMouseArea
76 anchors.fill: parent
77 cursorShape: Qt.PointingHandCursor
78 hoverEnabled: true
79
80 onClicked: {
81 controller.index = controller.index - 1
82 }
83 }
84 }
85
86 Text {
87 id: closeText
88
89 anchors {
90 margins: Style.margin
91 horizontalCenter: parent.horizontalCenter
92 top: tipText.bottom
93 }
94
95 text: qsTr("Close")
96 color: closeMouseArea.containsMouse ? Style.themeContrastLinkColor : Style.themeContrastTextColor
97 width: implicitWidth
98 horizontalAlignment: Text.AlignHCenter
99
100 MouseArea {
101 id: closeMouseArea
102 hoverEnabled: true
103 anchors.fill: parent
104 cursorShape: Qt.PointingHandCursor
105 onClicked: controller.close();
106 }
107 }
108
109 Text {
110 anchors {
111 margins: Style.margin
112 right: parent.right
113 top: tipText.bottom
114 }
115
116 text: ">"
117 color: nextMouseArea.containsMouse ? Style.themeContrastLinkColor : Style.themeContrastTextColor
118 visible: controller.index < (controller.count - 1)
119
120 MouseArea {
121 id: nextMouseArea
122 anchors.fill: parent
123 hoverEnabled: true
124 onClicked: {
125 controller.index = controller.index + 1
126 }
127 cursorShape: Qt.PointingHandCursor
128 }
129 }
130 } // of tip content box
131 } // of tip background shape
132 }