QGCComboBox.qml 1.7 KB
Newer Older
1 2 3
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
4
import QtQuick.Controls.Private 1.0
5 6

import QGroundControl.Palette 1.0
7
import QGroundControl.ScreenTools 1.0
8 9

ComboBox {
10 11 12
    property var    _qgcPal:        QGCPalette { colorGroupEnabled: enabled }
    property bool   _showHighlight: pressed | hovered
    property bool   _showBorder:    _qgcPal.globalTheme == QGCPalette.Light
13 14

    style: ComboBoxStyle {
Don Gagne's avatar
Don Gagne committed
15
        font.pixelSize: ScreenTools.defaultFontPixelSize
16 17 18
        textColor: _showHighlight ?
                    control._qgcPal.buttonHighlightText :
                    control._qgcPal.buttonText
19 20

        background: Item {
21 22 23 24 25 26 27 28
            implicitWidth:  Math.round(TextSingleton.implicitHeight * 4.5)
            implicitHeight: {
                if(ScreenTools.isTinyScreen)
                    return ScreenTools.defaultFontPixelHeight * 3.5
                if(ScreenTools.isMobile)
                    return ScreenTools.defaultFontPixelHeight * 2.5
                return Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
            }
29 30

            Rectangle {
31 32 33 34
                anchors.fill:   parent
                color:          _showHighlight ? control._qgcPal.buttonHighlight : control._qgcPal.button
                border.width:   _showBorder ? 1: 0
                border.color:  control._qgcPal.buttonText
35 36 37 38
            }

            Image {
                id: imageItem
39
                source: "/qmlimages/arrow-down.png"
40 41 42 43 44 45 46
                anchors.verticalCenter: parent.verticalCenter
                anchors.right: parent.right
                anchors.rightMargin: dropDownButtonWidth / 2
                opacity: control.enabled ? 0.6 : 0.3
            }
        }
    }
47
}