QmlTest.qml 13.8 KB
Newer Older
Don Gagne's avatar
Don Gagne committed
1 2 3 4 5 6
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2

import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
7
import QGroundControl.FactControls 1.0
Don Gagne's avatar
Don Gagne committed
8 9 10

Rectangle {

11
    property var palette: QGCPalette { colorGroupEnabled: true }
Don Gagne's avatar
Don Gagne committed
12 13
    color: palette.window

14 15
    Row {
        spacing: 30
Don Gagne's avatar
Don Gagne committed
16 17

        Grid {
18
            columns: 3
Don Gagne's avatar
Don Gagne committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
            spacing: 5

            Component {
                id: colorSquare

                Rectangle {
                    width: 80
                    height: 20
                    border.width: 1
                    border.color: "white"
                    color: parent.color
                }
            }

            Component {
                id: rowHeader

                Text {
37
                    width: 180
Don Gagne's avatar
Don Gagne committed
38 39 40
                    height: 20
                    horizontalAlignment: Text.AlignRight
                    verticalAlignment: Text.AlignVCenter
41
                    color: palette.text
Don Gagne's avatar
Don Gagne committed
42 43 44 45 46 47 48 49 50 51 52 53 54
                    text: parent.text
                }
            }


            // Header row
            Loader {
                sourceComponent: rowHeader
                property var text: ""
            }
            Text {
                width: 80
                height: 20
55
                color: palette.text
Don Gagne's avatar
Don Gagne committed
56 57 58 59 60 61
                horizontalAlignment: Text.AlignHCenter
                text: "Disabled"
            }
            Text {
                width: 80
                height: 20
62
                color: palette.text
Don Gagne's avatar
Don Gagne committed
63
                horizontalAlignment: Text.AlignHCenter
64
                text: "Enabled"
Don Gagne's avatar
Don Gagne committed
65 66
            }

67
            // window
Don Gagne's avatar
Don Gagne committed
68 69
            Loader {
                sourceComponent: rowHeader
70
                property var text: "window"
Don Gagne's avatar
Don Gagne committed
71 72
            }
            Loader {
73 74
                property var palette: QGCPalette { colorGroupEnabled: false }
                property var color: palette.window
Don Gagne's avatar
Don Gagne committed
75 76 77
                sourceComponent: colorSquare
            }
            Loader {
78 79
                property var palette: QGCPalette { colorGroupEnabled: true }
                property var color: palette.window
Don Gagne's avatar
Don Gagne committed
80 81 82
                sourceComponent: colorSquare
            }

83
            // windowShade
Don Gagne's avatar
Don Gagne committed
84 85
            Loader {
                sourceComponent: rowHeader
86
                property var text: "windowShade"
Don Gagne's avatar
Don Gagne committed
87 88
            }
            Loader {
89 90
                property var palette: QGCPalette { colorGroupEnabled: false }
                property var color: palette.windowShade
Don Gagne's avatar
Don Gagne committed
91 92 93
                sourceComponent: colorSquare
            }
            Loader {
94 95
                property var palette: QGCPalette { colorGroupEnabled: true }
                property var color: palette.windowShade
Don Gagne's avatar
Don Gagne committed
96 97 98
                sourceComponent: colorSquare
            }

99
            // windowShadeDark
Don Gagne's avatar
Don Gagne committed
100 101
            Loader {
                sourceComponent: rowHeader
102
                property var text: "windowShadeDark"
Don Gagne's avatar
Don Gagne committed
103 104
            }
            Loader {
105 106
                property var palette: QGCPalette { colorGroupEnabled: false }
                property var color: palette.windowShadeDark
Don Gagne's avatar
Don Gagne committed
107 108 109
                sourceComponent: colorSquare
            }
            Loader {
110 111
                property var palette: QGCPalette { colorGroupEnabled: true }
                property var color: palette.windowShadeDark
Don Gagne's avatar
Don Gagne committed
112 113 114
                sourceComponent: colorSquare
            }

115
            // text
Don Gagne's avatar
Don Gagne committed
116 117
            Loader {
                sourceComponent: rowHeader
118
                property var text: "text"
Don Gagne's avatar
Don Gagne committed
119 120
            }
            Loader {
121 122
                property var palette: QGCPalette { colorGroupEnabled: false }
                property var color: palette.text
Don Gagne's avatar
Don Gagne committed
123 124 125
                sourceComponent: colorSquare
            }
            Loader {
126 127
                property var palette: QGCPalette { colorGroupEnabled: true }
                property var color: palette.text
Don Gagne's avatar
Don Gagne committed
128 129
                sourceComponent: colorSquare
            }
130 131

            // button
Don Gagne's avatar
Don Gagne committed
132
            Loader {
133 134 135 136 137 138 139 140 141 142 143
                sourceComponent: rowHeader
                property var text: "button"
            }
            Loader {
                property var palette: QGCPalette { colorGroupEnabled: false }
                property var color: palette.button
                sourceComponent: colorSquare
            }
            Loader {
                property var palette: QGCPalette { colorGroupEnabled: true }
                property var color: palette.button
Don Gagne's avatar
Don Gagne committed
144 145 146
                sourceComponent: colorSquare
            }

147
            // buttonText
Don Gagne's avatar
Don Gagne committed
148 149 150 151 152
            Loader {
                sourceComponent: rowHeader
                property var text: "buttonText"
            }
            Loader {
153
                property var palette: QGCPalette { colorGroupEnabled: false }
Don Gagne's avatar
Don Gagne committed
154 155 156 157
                property var color: palette.buttonText
                sourceComponent: colorSquare
            }
            Loader {
158
                property var palette: QGCPalette { colorGroupEnabled: true }
Don Gagne's avatar
Don Gagne committed
159 160 161 162
                property var color: palette.buttonText
                sourceComponent: colorSquare
            }

163
            // buttonHighlight
Don Gagne's avatar
Don Gagne committed
164 165
            Loader {
                sourceComponent: rowHeader
166
                property var text: "buttonHighlight"
Don Gagne's avatar
Don Gagne committed
167 168
            }
            Loader {
169 170
                property var palette: QGCPalette { colorGroupEnabled: false }
                property var color: palette.buttonHighlight
Don Gagne's avatar
Don Gagne committed
171 172 173
                sourceComponent: colorSquare
            }
            Loader {
174 175
                property var palette: QGCPalette { colorGroupEnabled: true }
                property var color: palette.buttonHighlight
Don Gagne's avatar
Don Gagne committed
176 177 178
                sourceComponent: colorSquare
            }

179
            // buttonHighlightText
Don Gagne's avatar
Don Gagne committed
180 181
            Loader {
                sourceComponent: rowHeader
182
                property var text: "buttonHighlightText"
Don Gagne's avatar
Don Gagne committed
183 184
            }
            Loader {
185 186
                property var palette: QGCPalette { colorGroupEnabled: false }
                property var color: palette.buttonHighlightText
Don Gagne's avatar
Don Gagne committed
187 188 189
                sourceComponent: colorSquare
            }
            Loader {
190 191
                property var palette: QGCPalette { colorGroupEnabled: true }
                property var color: palette.buttonHighlightText
Don Gagne's avatar
Don Gagne committed
192 193 194
                sourceComponent: colorSquare
            }

195
            // primaryButton
196 197
            Loader {
                sourceComponent: rowHeader
198
                property var text: "primaryButton"
199 200
            }
            Loader {
201 202
                property var palette: QGCPalette { colorGroupEnabled: false }
                property var color: palette.primaryButton
203 204 205
                sourceComponent: colorSquare
            }
            Loader {
206 207
                property var palette: QGCPalette { colorGroupEnabled: true }
                property var color: palette.primaryButton
208 209 210
                sourceComponent: colorSquare
            }

211
            // primaryButtonText
212 213
            Loader {
                sourceComponent: rowHeader
214
                property var text: "primaryButtonText"
215 216
            }
            Loader {
217 218
                property var palette: QGCPalette { colorGroupEnabled: false }
                property var color: palette.primaryButtonText
219 220 221
                sourceComponent: colorSquare
            }
            Loader {
222 223
                property var palette: QGCPalette { colorGroupEnabled: true }
                property var color: palette.primaryButtonText
224 225 226
                sourceComponent: colorSquare
            }

227
            // textField
Don Gagne's avatar
Don Gagne committed
228 229
            Loader {
                sourceComponent: rowHeader
230
                property var text: "textField"
Don Gagne's avatar
Don Gagne committed
231 232
            }
            Loader {
233 234
                property var palette: QGCPalette { colorGroupEnabled: false }
                property var color: palette.textField
Don Gagne's avatar
Don Gagne committed
235 236 237
                sourceComponent: colorSquare
            }
            Loader {
238 239
                property var palette: QGCPalette { colorGroupEnabled: true }
                property var color: palette.textField
Don Gagne's avatar
Don Gagne committed
240 241
                sourceComponent: colorSquare
            }
242 243 244 245 246 247

            // textFieldText
            Loader {
                sourceComponent: rowHeader
                property var text: "textFieldText"
            }
Don Gagne's avatar
Don Gagne committed
248
            Loader {
249 250 251 252 253 254 255
                property var palette: QGCPalette { colorGroupEnabled: false }
                property var color: palette.textFieldText
                sourceComponent: colorSquare
            }
            Loader {
                property var palette: QGCPalette { colorGroupEnabled: true }
                property var color: palette.textFieldText
Don Gagne's avatar
Don Gagne committed
256 257 258 259 260 261 262
                sourceComponent: colorSquare
            }

        }

        Grid {
            columns: 3
263
            spacing: 10
Don Gagne's avatar
Don Gagne committed
264 265 266 267 268 269 270 271 272

            Component {
                id: ctlRowHeader

                Text {
                    width: 120
                    height: 20
                    horizontalAlignment: Text.AlignRight
                    verticalAlignment: Text.AlignVCenter
273
                    color: palette.text
Don Gagne's avatar
Don Gagne committed
274 275 276 277 278 279 280 281 282 283 284 285 286
                    text: parent.text
                }
            }


            // Header row
            Loader {
                sourceComponent: ctlRowHeader
                property var text: ""
            }
            Text {
                width: 100
                height: 20
287
                color: palette.text
Don Gagne's avatar
Don Gagne committed
288 289 290 291 292 293
                horizontalAlignment: Text.AlignHCenter
                text: "Enabled"
            }
            Text {
                width: 100
                height: 20
294
                color: palette.text
Don Gagne's avatar
Don Gagne committed
295 296 297 298
                horizontalAlignment: Text.AlignHCenter
                text: "Disabled"
            }

299
            // QGCLabel
Don Gagne's avatar
Don Gagne committed
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
            Loader {
                sourceComponent: ctlRowHeader
                property var text: "QGCLabel"
            }
            QGCLabel {
                width: 100
                height: 20
                text: "Label"
            }
            QGCLabel {
                width: 100
                height: 20
                text: "Label"
                enabled: false
            }

316
            // QGCButton
Don Gagne's avatar
Don Gagne committed
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
            Loader {
                sourceComponent: ctlRowHeader
                property var text: "QGCButton"
            }
            QGCButton {
                width: 100
                height: 20
                text: "Button"
            }
            QGCButton {
                width: 100
                height: 20
                text: "Button"
                enabled: false
            }

333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352
            // QGCButton - primary
            Loader {
                sourceComponent: ctlRowHeader
                property var text: "QGCButton(primary)"
            }
            QGCButton {
                width: 100
                height: 20
                primary: true
                text: "Button"
            }
            QGCButton {
                width: 100
                height: 20
                text: "Button"
                primary: true
                enabled: false
            }

            // QGCRadioButton
Don Gagne's avatar
Don Gagne committed
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368
            Loader {
                sourceComponent: ctlRowHeader
                property var text: "QGCRadioButton"
            }
            QGCRadioButton {
                width: 100
                height: 20
                text: "Radio"
            }
            QGCRadioButton {
                width: 100
                height: 20
                text: "Radio"
                enabled: false
            }

369
            // QGCCheckBox
Don Gagne's avatar
Don Gagne committed
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385
            Loader {
                sourceComponent: ctlRowHeader
                property var text: "QGCCheckBox"
            }
            QGCCheckBox {
                width: 100
                height: 20
                text: "Check Box"
            }
            QGCCheckBox {
                width: 100
                height: 20
                text: "Check Box"
                enabled: false
            }

386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467
            // QGCTextField
            Loader {
                sourceComponent: ctlRowHeader
                property var text: "QGCTextField"
            }
            QGCTextField {
                width: 100
                height: 20
                text: "QGCTextField"
            }
            QGCTextField {
                width: 100
                height: 20
                text: "QGCTextField"
                enabled: false
            }

            // FactLabel
            Loader {
                sourceComponent: ctlRowHeader
                property var text: "FactLabel"
            }
            FactLabel {
                width: 100
                height: 20
            }
            FactLabel {
                width: 100
                height: 20
                enabled: false
            }

            // FactCheckBox
            Loader {
                sourceComponent: ctlRowHeader
                property var text: "FactCheckBox"
            }
            FactCheckBox {
                width: 100
                height: 20
                text: "Fact CheckBox"
            }
            FactCheckBox {
                width: 100
                height: 20
                text: "Fact CheckBox"
                enabled: false
            }

            // FactTextField
            Loader {
                sourceComponent: ctlRowHeader
                property var text: "FactTextField"
            }
            FactTextField {
                width: 100
                height: 20
                text: "FactTextField"
            }
            FactTextField {
                width: 100
                height: 20
                text: "FactTextField"
                enabled: false
            }

            // SubMenuButton
            Loader {
                sourceComponent: ctlRowHeader
                property var text: "SubMenuButton"
            }
            SubMenuButton {
                width: 100
                height: 100
                text: "SUB MENU"
            }
            SubMenuButton {
                width: 100
                height: 100
                text: "SUB MENU"
                enabled: false
            }
Don Gagne's avatar
Don Gagne committed
468 469 470
        }
    }
}