diff options
author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2013-03-25 18:42:21 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-26 16:06:08 +0100 |
commit | c1479a9d971b1add0aad43a5e06ad266b2dff9d1 (patch) | |
tree | d8b10836bb913722368407be798d65fb89cb9996 | |
parent | 2fa076d30ad5136a49f293f0aa3e5429ad7b831b (diff) | |
download | qtquickcontrols-c1479a9d971b1add0aad43a5e06ad266b2dff9d1.tar.gz |
ComboBox: Fix style content size calculation
Expression taken from QComboBox. Also, cleaner way of setting the
popup item font size where needed.
Change-Id: Ic6997e8d887dafc519a3827c2a40cb8f91503ebc
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
-rw-r--r-- | src/controls/ComboBox.qml | 8 | ||||
-rw-r--r-- | src/styles/Desktop/ComboBoxStyle.qml | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml index fadd2a16..5127954e 100644 --- a/src/controls/ComboBox.qml +++ b/src/controls/ComboBox.qml @@ -104,7 +104,11 @@ Control { onPressedChanged: if (pressed) popup.show() } - StyleItem { id: styleItem } + StyleItem { + id: styleItem + elementType: "comboboxitem" + visible: false + } Component.onCompleted: { if (currentIndex === -1) @@ -112,7 +116,6 @@ Control { if (styleItem.style == "mac") { popup.x -= 10 popup.y += 4 - popup.__font.pointSize = 13 } popup.ready = true @@ -136,6 +139,7 @@ Control { property int y: isPopup ? (comboBox.__panel.height - comboBox.__panel.implicitHeight) / 2.0 : comboBox.__panel.height __minimumWidth: comboBox.width __visualItem: comboBox + __font: styleItem.font property ExclusiveGroup eg: ExclusiveGroup { id: eg } diff --git a/src/styles/Desktop/ComboBoxStyle.qml b/src/styles/Desktop/ComboBoxStyle.qml index 252d5972..36d00dc4 100644 --- a/src/styles/Desktop/ComboBoxStyle.qml +++ b/src/styles/Desktop/ComboBoxStyle.qml @@ -54,7 +54,8 @@ Style { enabled: control.enabled text: control.currentText hasFocus: control.activeFocus - contentHeight: 18 + // contentHeight as in QComboBox + contentHeight: Math.max(Math.ceil(textHeight("")), 14) + 2 contentWidth: textWidth(text) } |