summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-05-14 11:10:33 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-15 16:52:40 +0200
commit09c4c95cf067a7a2a6abf97b60427ae8f7df6bdd (patch)
treea0197813208040d422fedfad8eac977c10518765
parent42d64cd1a466afea0db7d9608a489d67e9237831 (diff)
downloadqtquickcontrols-09c4c95cf067a7a2a6abf97b60427ae8f7df6bdd.tar.gz
qtquickcontrols-09c4c95cf067a7a2a6abf97b60427ae8f7df6bdd.tar.bz2
qtquickcontrols-09c4c95cf067a7a2a6abf97b60427ae8f7df6bdd.zip
TextFieldStyle: more fool-proof size calculation
This ensures that such style gets a sensible default size: TextField { text: "Hello" style: TextFieldStyle { font.pixelSize: 30 background: Rectangle { color:"lightgray" } } } Change-Id: I370d8ad324cda09c9b085191ab452c4f8994d1d9 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
-rw-r--r--src/controls/Styles/Base/TextFieldStyle.qml9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/controls/Styles/Base/TextFieldStyle.qml b/src/controls/Styles/Base/TextFieldStyle.qml
index 80fa9c8e..d999551c 100644
--- a/src/controls/Styles/Base/TextFieldStyle.qml
+++ b/src/controls/Styles/Base/TextFieldStyle.qml
@@ -114,9 +114,6 @@ Style {
/*! The background of the text field. */
property Component background: Item {
- implicitWidth: Math.round(control.__contentHeight * 8)
- implicitHeight: Math.max(25, Math.round(control.__contentHeight * 1.2))
- baselineOffset: control.__baselineOffset
Rectangle {
anchors.fill: parent
anchors.bottomMargin: -1
@@ -149,9 +146,9 @@ Style {
property color selectionColor: style.selectionColor
property color selectedTextColor: style.selectedTextColor
- implicitWidth: backgroundLoader.implicitWidth ? backgroundLoader.implicitWidth : 100
- implicitHeight: backgroundLoader.implicitHeight ? backgroundLoader.implicitHeight : 20
- baselineOffset: backgroundLoader.item ? padding.top + backgroundLoader.item.baselineOffset : 0
+ implicitWidth: backgroundLoader.implicitWidth || Math.round(control.__contentHeight * 8)
+ implicitHeight: backgroundLoader.implicitHeight || Math.max(25, Math.round(control.__contentHeight * 1.2))
+ baselineOffset: padding.top + control.__baselineOffset
property color placeholderTextColor: style.placeholderTextColor
property font font: style.font