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

import QGroundControl.Palette 1.0

Button {
8 9 10 11 12 13
    // primary: true - this is the primary button for this group of buttons
    property bool primary: false

    property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }

    property bool __showHighlight: pressed | hovered | checked
Don Gagne's avatar
Don Gagne committed
14 15 16 17 18

    style: ButtonStyle {
            background: Rectangle {
                implicitWidth: 100
                implicitHeight: 25
19 20 21
                color: __showHighlight ?
                    control.__qgcPal.buttonHighlight :
                    (primary ? control.__qgcPal.primaryButton : control.__qgcPal.button)
Don Gagne's avatar
Don Gagne committed
22 23 24 25 26 27 28 29 30 31
            }

            label: Text {
                width: parent.width
                height: parent.height

                verticalAlignment: TextEdit.AlignVCenter
                horizontalAlignment: TextEdit.AlignHCenter

                text: control.text
32 33 34
                color: __showHighlight ?
                    control.__qgcPal.buttonHighlightText :
                    (primary ? control.__qgcPal.primaryButtonText : control.__qgcPal.buttonText)
Don Gagne's avatar
Don Gagne committed
35 36 37
            }
        }
}