diff options
| author | Jan Arve Saether <jan-arve.saether@digia.com> | 2014-02-20 19:23:44 +0100 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-26 11:05:36 +0100 |
| commit | 41f44e224695789974e2c92db95810e19e6fab49 (patch) | |
| tree | 9e31bbf8b04aa7c90d32a36a25d7d57de7ba16d7 | |
| parent | 9bdbff5a14f340b6b12f1fcd84608d17bdc67d70 (diff) | |
Set baselineOffset on Styles/Base correctly
Fixes the baselineOffset for TextField and SpinBox
Task-number: QTBUG-36529
Change-Id: I697d4c8bc2ee61929eabb54a6ec6520311a4e3e2
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
| -rw-r--r-- | src/controls/SpinBox.qml | 3 | ||||
| -rw-r--r-- | src/controls/Styles/Base/SpinBoxStyle.qml | 2 | ||||
| -rw-r--r-- | src/controls/Styles/Base/TextFieldStyle.qml | 2 | ||||
| -rw-r--r-- | src/controls/TextField.qml | 3 |
4 files changed, 10 insertions, 0 deletions
diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml index 8fc964a06..f235dfbd2 100644 --- a/src/controls/SpinBox.qml +++ b/src/controls/SpinBox.qml @@ -194,6 +194,9 @@ Control { /*! \internal */ property alias __text: input.text + /*! \internal */ + property alias __baselineOffset: input.baselineOffset + __styleData: QtObject { readonly property bool upEnabled: value != maximumValue; readonly property alias upHovered: mouseUp.containsMouse diff --git a/src/controls/Styles/Base/SpinBoxStyle.qml b/src/controls/Styles/Base/SpinBoxStyle.qml index 9cedf2b98..183b36b8b 100644 --- a/src/controls/Styles/Base/SpinBoxStyle.qml +++ b/src/controls/Styles/Base/SpinBoxStyle.qml @@ -142,6 +142,7 @@ Style { property Component background: Item { implicitHeight: Math.max(25, Math.round(styleData.contentHeight * 1.2)) implicitWidth: styleData.contentWidth + padding.left + padding.right + baselineOffset: control.__baselineOffset Rectangle { anchors.fill: parent anchors.bottomMargin: -1 @@ -166,6 +167,7 @@ Style { id: styleitem implicitWidth: backgroundLoader.implicitWidth implicitHeight: backgroundLoader.implicitHeight + baselineOffset: backgroundLoader.item ? backgroundLoader.item.baselineOffset : 0 property color foregroundColor: spinboxStyle.textColor property color selectionColor: spinboxStyle.selectionColor diff --git a/src/controls/Styles/Base/TextFieldStyle.qml b/src/controls/Styles/Base/TextFieldStyle.qml index 4713130f3..1b732cee7 100644 --- a/src/controls/Styles/Base/TextFieldStyle.qml +++ b/src/controls/Styles/Base/TextFieldStyle.qml @@ -116,6 +116,7 @@ Style { 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 @@ -150,6 +151,7 @@ Style { implicitWidth: backgroundLoader.implicitWidth ? backgroundLoader.implicitWidth : 100 implicitHeight: backgroundLoader.implicitHeight ? backgroundLoader.implicitHeight : 20 + baselineOffset: backgroundLoader.item ? padding.top + backgroundLoader.item.baselineOffset : 0 property color placeholderTextColor: style.placeholderTextColor property font font: style.font diff --git a/src/controls/TextField.qml b/src/controls/TextField.qml index b173c95db..3d11fc2e7 100644 --- a/src/controls/TextField.qml +++ b/src/controls/TextField.qml @@ -549,6 +549,9 @@ Control { /*! \internal */ property alias __contentWidth: textInput.contentWidth + /*! \internal */ + property alias __baselineOffset: textInput.baselineOffset + style: Qt.createComponent(Settings.style + "/TextFieldStyle.qml", textInput) activeFocusOnTab: true |
