diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2014-07-18 14:49:00 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@digia.com> | 2014-07-18 16:43:25 +0200 |
commit | 85452fe6f4d30e09107533a488c39f895605aed7 (patch) | |
tree | 9ad75d6228f5e17dceb761705d3101634b5e3c2c /tests/manual | |
parent | 1f8cccd791b0fe401692d5a6eaa865606e479cc5 (diff) | |
download | qtquickcontrols-85452fe6f4d30e09107533a488c39f895605aed7.tar.gz |
Add styleData.hasSelection for text selection handles
Text selection handles typically look different based on whether the
editor has selection or not (one handle for moving the cursor vs. two
handles for selecting text). SpinBox and ComboBox do not have suitable
properties for testing whether the control has selection or not, so
styleData.hasSelection is introduced to abstract and expose that
information.
Task-number: QTBUG-38934
Change-Id: I362b5790f5d487e5ba258e42d1b801a5cce76770
Reviewed-by: Liang Qi <liang.qi@digia.com>
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/texthandles/main.qml | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/manual/texthandles/main.qml b/tests/manual/texthandles/main.qml index c7b824a4..24c501e0 100644 --- a/tests/manual/texthandles/main.qml +++ b/tests/manual/texthandles/main.qml @@ -146,7 +146,7 @@ ApplicationWindow { anchors.right: parent.right anchors.rightMargin: width / 2 anchors.verticalCenter: parent.verticalCenter - visible: control.activeFocus && control.selectionStart !== control.selectionEnd + visible: control.activeFocus && styleData.hasSelection } } } @@ -154,7 +154,7 @@ ApplicationWindow { Component { id: cursorDelegate Rectangle { - x: control.selectionStart !== control.selectionEnd ? -edit.font.pixelSize / 2 : -width / 2 + x: styleData.hasSelection ? -edit.font.pixelSize / 2 : -width / 2 y: (styleData.lineHeight - height) / 2 width: edit.font.pixelSize * 2.5 height: edit.font.pixelSize * 2.5 @@ -170,7 +170,7 @@ ApplicationWindow { anchors.left: parent.left anchors.leftMargin: width / 2 anchors.verticalCenter: parent.verticalCenter - visible: control.activeFocus && control.selectionStart !== control.selectionEnd + visible: control.activeFocus && styleData.hasSelection } } } |