From 0d2a1d22aa9be63c7f751e822140238fc52936fa Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 28 Jul 2014 13:08:59 +0200 Subject: ComboBox: respect style padding for the editor Get rid of the hard coded 8px left margin and use whatever value the style supplies (and is already used for the label). This allows the Android style to provide a sensible value for High DPI screens. The new value for the left margin is 6px in Base and Desktop styles. It looks slightly better, but still not pixel perfect. Notice that the text label of editable and non-editable ComboBoxes are not perfectly aligned in native Windows and OS X ComboBoxes either. Change-Id: I9a66c3a26fcd9ef1653b355e831277a7b6cbe72f Reviewed-by: Gabriel de Dietrich --- src/controls/ComboBox.qml | 6 ++++-- src/controls/Styles/Desktop/ComboBoxStyle.qml | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml index 768077a9..82d718c3 100644 --- a/src/controls/ComboBox.qml +++ b/src/controls/ComboBox.qml @@ -394,8 +394,10 @@ Control { selectionHandle: __style ? __style.selectionHandle : undefined anchors.fill: parent - anchors.leftMargin: 8 - anchors.rightMargin: __panel.dropDownButtonWidth + __style.padding.right + anchors.leftMargin: __style ? __style.padding.left : 0 + anchors.topMargin: __style ? __style.padding.top : 0 + anchors.rightMargin: __style ? __panel.dropDownButtonWidth + __style.padding.right : 0 + anchors.bottomMargin: __style ? __style.padding.bottom: 0 verticalAlignment: Text.AlignVCenter diff --git a/src/controls/Styles/Desktop/ComboBoxStyle.qml b/src/controls/Styles/Desktop/ComboBoxStyle.qml index c644544f..d897a2a4 100644 --- a/src/controls/Styles/Desktop/ComboBoxStyle.qml +++ b/src/controls/Styles/Desktop/ComboBoxStyle.qml @@ -46,6 +46,7 @@ import "." as Desktop Style { readonly property ComboBox control: __control property int renderType: Text.NativeRendering + padding { top: 4 ; left: 6 ; right: 6 ; bottom:4 } property Component panel: Item { property bool popup: !!styleItem.styleHint("comboboxpopup") property color textColor: SystemPaletteSingleton.text(control.enabled) -- cgit v1.2.1