QGCComboBox.qml 1.4 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 13
    property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
    property bool __showHighlight: pressed | hovered

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

        background: Item {
            implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5)
21
            implicitHeight: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 3 * 0.75 : Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
22 23 24 25 26 27 28 29 30 31 32

            Rectangle {
                anchors.fill: parent
                color: __showHighlight ?
                    control.__qgcPal.buttonHighlight :
                    control.__qgcPal.button
            }

            Image {
                id: imageItem
                visible: control.menu !== null
33
                source: "/qmlimages/arrow-down.png"
34 35 36 37 38 39 40
                anchors.verticalCenter: parent.verticalCenter
                anchors.right: parent.right
                anchors.rightMargin: dropDownButtonWidth / 2
                opacity: control.enabled ? 0.6 : 0.3
            }
        }
    }
41
}