QGCToolBarButton.qml 1.96 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
9 10


11
import QtQuick          2.3
Gus Grubba's avatar
Gus Grubba committed
12
import QtQuick.Controls 2.4
13

14 15 16
import QGroundControl.Controls      1.0
import QGroundControl.Palette       1.0
import QGroundControl.ScreenTools   1.0
17

Gus Grubba's avatar
Gus Grubba committed
18 19 20 21
Button {
    id:                 button
    height:             ScreenTools.defaultFontPixelHeight * 3
    autoExclusive:      true
dogmaphobic's avatar
dogmaphobic committed
22

23 24
    property bool logo: false

Gus Grubba's avatar
Gus Grubba committed
25 26
    background: Rectangle {
        anchors.fill: parent
27
        color:  logo ? qgcPal.brandingPurple : (checked ? qgcPal.buttonHighlight : Qt.rgba(0,0,0,0))
dogmaphobic's avatar
dogmaphobic committed
28 29
    }

Gus Grubba's avatar
Gus Grubba committed
30 31 32 33 34 35 36 37 38 39 40
    contentItem: Row {
        spacing:                    ScreenTools.defaultFontPixelWidth
        anchors.left:               button.left
        anchors.leftMargin:         ScreenTools.defaultFontPixelWidth
        anchors.verticalCenter:     button.verticalCenter
        QGCColoredImage {
            id:                     _icon
            height:                 ScreenTools.defaultFontPixelHeight * 2
            width:                  height
            sourceSize.height:      parent.height
            fillMode:               Image.PreserveAspectFit
41
            color:                  logo ? "white" : (button.checked ? qgcPal.buttonHighlightText : qgcPal.buttonText)
Gus Grubba's avatar
Gus Grubba committed
42 43 44 45 46
            source:                 button.icon.source
            anchors.verticalCenter: parent.verticalCenter
        }
        Label {
            id:                     _label
47
            visible:                text !== ""
Gus Grubba's avatar
Gus Grubba committed
48 49 50
            text:                   button.text
            color:                  button.checked ? qgcPal.buttonHighlightText : qgcPal.buttonText
            anchors.verticalCenter: parent.verticalCenter
dogmaphobic's avatar
dogmaphobic committed
51 52
        }
    }
Gus Grubba's avatar
Gus Grubba committed
53

dogmaphobic's avatar
dogmaphobic committed
54
}