Skip to content
QmlTest.qml 41.5 KiB
Newer Older
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts          1.2
Don Gagne's avatar
Don Gagne committed

import QGroundControl.Palette       1.0
import QGroundControl.Controls      1.0
import QGroundControl.ScreenTools   1.0
Don Gagne's avatar
Don Gagne committed

Rectangle {


    QGCPalette { id: qgcPal; colorGroupEnabled: enabled }

    property var palette: QGCPalette { colorGroupEnabled: true }
    color: "white"
Don Gagne's avatar
Don Gagne committed

    Component {
        id: arbBox
        Rectangle {
            width:  arbGrid.width  * 1.5
            height: arbGrid.height * 1.5
            color:  backgroundColor
            border.color: qgcPal.text
            border.width: 1
            anchors.horizontalCenter: parent.horizontalCenter
            GridLayout {
                id: arbGrid
                columns: 4
                rowSpacing: 10
                anchors.centerIn: parent
                QGCColoredImage {
                    color:                      qgcPal.colorGreen
                    width:                      ScreenTools.defaultFontPixelWidth * 2
                    height:                     width
                    sourceSize.height:          width
                    mipmap:                     true
                    fillMode:                   Image.PreserveAspectFit
                    source:                     "/qmlimages/Gears.svg"
                }
                Label { text: "colorGreen"; color: qgcPal.colorGreen; }
                QGCColoredImage {
                    color:                      qgcPal.colorOrange
                    width:                      ScreenTools.defaultFontPixelWidth * 2
                    height:                     width
                    sourceSize.height:          width
                    mipmap:                     true
                    fillMode:                   Image.PreserveAspectFit
                    source:                     "/qmlimages/Gears.svg"
                }
                Label { text: "colorOrange"; color: qgcPal.colorOrange; }
                QGCColoredImage {
                    color:                      qgcPal.colorRed
                    width:                      ScreenTools.defaultFontPixelWidth * 2
                    height:                     width
                    sourceSize.height:          width
                    mipmap:                     true
                    fillMode:                   Image.PreserveAspectFit
                    source:                     "/qmlimages/Gears.svg"
                }
                Label { text: "colorRed"; color: qgcPal.colorRed; }
                QGCColoredImage {
                    color:                      qgcPal.colorGrey
                    width:                      ScreenTools.defaultFontPixelWidth * 2
                    height:                     width
                    sourceSize.height:          width
                    mipmap:                     true
                    fillMode:                   Image.PreserveAspectFit
                    source:                     "/qmlimages/Gears.svg"
                }
                Label { text: "colorGrey"; color: qgcPal.colorGrey;  }
                QGCColoredImage {
                    color:                      qgcPal.colorBlue
                    width:                      ScreenTools.defaultFontPixelWidth * 2
                    height:                     width
                    sourceSize.height:          width
                    mipmap:                     true
                    fillMode:                   Image.PreserveAspectFit
                    source:                     "/qmlimages/Gears.svg"
                }
                Label { text: "colorBlue"; color: qgcPal.colorBlue; }
            }
        }
    }

Don Gagne's avatar
Don Gagne committed
    Column {
Don Gagne's avatar
Don Gagne committed

dogmaphobic's avatar
dogmaphobic committed
        Rectangle {
            width:  parent.width
            height: themeChoice.height * 2
            color:  palette.window
            QGCLabel {
Tomaz Canabrava's avatar
Tomaz Canabrava committed
                text: qsTr("Window Color")
dogmaphobic's avatar
dogmaphobic committed
                anchors.left:           parent.left
                anchors.leftMargin:     20
Don Gagne's avatar
Don Gagne committed
            }
dogmaphobic's avatar
dogmaphobic committed
            Row {
                id: themeChoice
                anchors.centerIn: parent
                anchors.margins: 20
                spacing:         20
                ExclusiveGroup { id: themeGroup }
                QGCRadioButton {
Tomaz Canabrava's avatar
Tomaz Canabrava committed
                    text: qsTr("Light")
dogmaphobic's avatar
dogmaphobic committed
                    checked: palette.globalTheme === QGCPalette.Light
                    exclusiveGroup: themeGroup
                    onClicked: { palette.globalTheme = QGCPalette.Light }
                }
                QGCRadioButton {
Tomaz Canabrava's avatar
Tomaz Canabrava committed
                    text: qsTr("Dark")
dogmaphobic's avatar
dogmaphobic committed
                    checked: palette.globalTheme === QGCPalette.Dark
                    exclusiveGroup: themeGroup
                    onClicked: { palette.globalTheme = QGCPalette.Dark }
                }
Don Gagne's avatar
Don Gagne committed
            }
Don Gagne's avatar
Don Gagne committed
        }

        Row {
            spacing: 30

            Grid {
                columns: 5
Don Gagne's avatar
Don Gagne committed
                spacing: 5

                Component {
                    id: rowHeader

                    Text {
                        width: 180
                        height: 20
                        horizontalAlignment: Text.AlignRight
                        verticalAlignment: Text.AlignVCenter
                        color: "black"
Don Gagne's avatar
Don Gagne committed
                        text: parent.text
                    }
                }
Don Gagne's avatar
Don Gagne committed

Don Gagne's avatar
Don Gagne committed
                // Header row
                Loader {
                    sourceComponent: rowHeader
                    property var text: ""
                }
Don Gagne's avatar
Don Gagne committed
                Text {
Don Gagne's avatar
Don Gagne committed
                    width: 80
Don Gagne's avatar
Don Gagne committed
                    height: 20
                    color: "black"
Don Gagne's avatar
Don Gagne committed
                    horizontalAlignment: Text.AlignHCenter
Tomaz Canabrava's avatar
Tomaz Canabrava committed
                    text: qsTr("Disabled")
Don Gagne's avatar
Don Gagne committed
                }
                Text {
                    width: 80
                    height: 20
                    color: "black"
Don Gagne's avatar
Don Gagne committed
                    horizontalAlignment: Text.AlignHCenter
Tomaz Canabrava's avatar
Tomaz Canabrava committed
                    text: qsTr("Enabled")
Don Gagne's avatar
Don Gagne committed
                }
                Text {
                    width: 80
                    height: 20
                    color: "black"
                    horizontalAlignment: Text.AlignHCenter
Tomaz Canabrava's avatar
Tomaz Canabrava committed
                    text: qsTr("Value")
                }
                Text {
                    width: 80
                    height: 20
                    color: "black"
                    horizontalAlignment: Text.AlignHCenter
Tomaz Canabrava's avatar
Tomaz Canabrava committed
                    text: qsTr("Value")
Don Gagne's avatar
Don Gagne committed

Don Gagne's avatar
Don Gagne committed
                // window
                Loader {
                    sourceComponent: rowHeader
                    property var text: "window"
                }
                ClickableColor {
Don Gagne's avatar
Don Gagne committed
                    property var palette: QGCPalette { colorGroupEnabled: false }
                    color: palette.window
                    onColorSelected: palette.window = color
Don Gagne's avatar
Don Gagne committed
                }
                ClickableColor {
Don Gagne's avatar
Don Gagne committed
                    property var palette: QGCPalette { colorGroupEnabled: true }
                    color: palette.window
                    onColorSelected: palette.window = color
                }
                Text {
                    width: 80
                    height: 20
                    color: "black"
                    horizontalAlignment: Text.AlignHCenter
                    property var palette: QGCPalette { colorGroupEnabled: false }
                    text: palette.window
                }
                Text {
                    width: 80
                    height: 20
                    color: "black"
                    horizontalAlignment: Text.AlignHCenter
                    property var palette: QGCPalette { colorGroupEnabled: true }
Loading
Loading full blame...