Unverified Commit 12c58934 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8028 from DonLakeFlyer/QGCComboBox

Tweak combobox visuals
parents ac8a932f 15c2e148
...@@ -15,16 +15,16 @@ import QtQuick.Templates 2.4 as T ...@@ -15,16 +15,16 @@ import QtQuick.Templates 2.4 as T
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
T.ComboBox { T.ComboBox {
id: control id: control
padding: ScreenTools.comboBoxPadding padding: ScreenTools.comboBoxPadding
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
implicitWidth: Math.max(background ? background.implicitWidth : 0, implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentItem.implicitWidth + leftPadding + rightPadding) contentItem.implicitWidth + leftPadding + rightPadding + padding)
implicitHeight: Math.max(background ? background.implicitHeight : 0, implicitHeight: Math.max(background ? background.implicitHeight : 0,
Math.max(contentItem.implicitHeight, Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
leftPadding: padding + (!control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing) leftPadding: padding + (!control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width) rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width)
...@@ -76,14 +76,14 @@ T.ComboBox { ...@@ -76,14 +76,14 @@ T.ComboBox {
highlighted: control.highlightedIndex === index highlighted: control.highlightedIndex === index
} }
// Dropdown indicator indicator: QGCColoredImage {
indicator: ColorImage { anchors.rightMargin: control.padding
x: control.mirrored ? control.padding : control.width - width anchors.right: parent.right
y: control.topPadding + (control.availableHeight - height) / 2 anchors.verticalCenter: parent.verticalCenter
color: _qgcPal.text height: ScreenTools.defaultFontPixelWidth
defaultColor: "#353637" width: height
source: "qrc:/qt-project.org/imports/QtQuick/Controls.2/images/double-arrow.png" source: "/qmlimages/arrow-down.png"
opacity: enabled ? 1 : 0.3 color: _qgcPal.text
} }
// The label of the button // The label of the button
......
...@@ -90,7 +90,7 @@ Item { ...@@ -90,7 +90,7 @@ Item {
property real implicitTextFieldHeight: Math.round(defaultFontPixelHeight * (isMobile ? 2.0 : 1.6)) property real implicitTextFieldHeight: Math.round(defaultFontPixelHeight * (isMobile ? 2.0 : 1.6))
property real implicitComboBoxHeight: Math.round(defaultFontPixelHeight * (isMobile ? 2.0 : 1.6)) property real implicitComboBoxHeight: Math.round(defaultFontPixelHeight * (isMobile ? 2.0 : 1.6))
property real implicitComboBoxWidth: Math.round(defaultFontPixelWidth * (isMobile ? 7.0 : 5.0)) property real implicitComboBoxWidth: Math.round(defaultFontPixelWidth * (isMobile ? 7.0 : 5.0))
property real comboBoxPadding: Math.round(defaultFontPixelWidth * (isShortScreen ? 1 : 0.5)) property real comboBoxPadding: defaultFontPixelWidth
property real implicitSliderHeight: isMobile ? Math.max(defaultFontPixelHeight, minTouchPixels) : defaultFontPixelHeight property real implicitSliderHeight: isMobile ? Math.max(defaultFontPixelHeight, minTouchPixels) : defaultFontPixelHeight
// It's not possible to centralize an even number of pixels, checkBoxIndicatorSize should be an odd number to allow centralization // It's not possible to centralize an even number of pixels, checkBoxIndicatorSize should be an odd number to allow centralization
property real checkBoxIndicatorSize: 2 * Math.floor(defaultFontPixelHeight * (isMobile ? 1.5 : 1.0) / 2) + 1 property real checkBoxIndicatorSize: 2 * Math.floor(defaultFontPixelHeight * (isMobile ? 1.5 : 1.0) / 2) + 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment