summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2014-11-06 15:35:49 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2014-11-07 13:38:50 +0100
commit9f4ff8ce499dd0d50d0b04cb88ffa981dddd006e (patch)
tree03461354c81ef4177fd8abac7ef874c06be865f5
parentcf26937de2910da16cb3299db5550ae16b926159 (diff)
downloadqtquickcontrols-9f4ff8ce499dd0d50d0b04cb88ffa981dddd006e.tar.gz
Let the cursor handle be visible regardless of selection
The cursor handle is visible on Android even when there's no selection. Let the style decide when to show/hide the handles, but make sure to disable the corresponding MouseArea when a handle is hidden. Change-Id: I211c122998223ad25279bee2841c5b5e14d4c48e Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
-rw-r--r--src/controls/Private/TextHandle.qml2
-rw-r--r--src/controls/Private/TextInputWithHandles.qml2
-rw-r--r--src/controls/Styles/iOS/CursorHandleStyle.qml1
-rw-r--r--src/controls/TextArea.qml2
4 files changed, 4 insertions, 3 deletions
diff --git a/src/controls/Private/TextHandle.qml b/src/controls/Private/TextHandle.qml
index 19fc19a6..8656dcfd 100644
--- a/src/controls/Private/TextHandle.qml
+++ b/src/controls/Private/TextHandle.qml
@@ -75,7 +75,7 @@ Loader {
MouseArea {
id: mouse
anchors.fill: item
- enabled: handle.active
+ enabled: item && item.visible
preventStealing: true
property real pressX
property point offset
diff --git a/src/controls/Private/TextInputWithHandles.qml b/src/controls/Private/TextInputWithHandles.qml
index ceb63084..726b6863 100644
--- a/src/controls/Private/TextInputWithHandles.qml
+++ b/src/controls/Private/TextInputWithHandles.qml
@@ -170,7 +170,7 @@ TextInput {
x: mappedPos.x
y: mappedPos.y
- visible: pressed || (input.hasSelection && handleX + handleWidth >= -1 && handleX <= control.width + 1)
+ visible: pressed || ((input.cursorVisible || input.hasSelection) && handleX + handleWidth >= -1 && handleX <= control.width + 1)
onPositionChanged: {
if (!input.blockRecursion) {
diff --git a/src/controls/Styles/iOS/CursorHandleStyle.qml b/src/controls/Styles/iOS/CursorHandleStyle.qml
index 26ab9728..408a7bf4 100644
--- a/src/controls/Styles/iOS/CursorHandleStyle.qml
+++ b/src/controls/Styles/iOS/CursorHandleStyle.qml
@@ -45,6 +45,7 @@ Item {
y: -20
width: 80
height: knob.height + knobLine.height + 60
+ visible: styleData.hasSelection
Rectangle {
id: knob
diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml
index 8cfb6dfd..691bf13e 100644
--- a/src/controls/TextArea.qml
+++ b/src/controls/TextArea.qml
@@ -933,7 +933,7 @@ ScrollView {
property var posInViewport: flickableItem.contentX !== flickableItem.contentY !== Number.MAX_VALUE ?
parent.mapToItem(viewport, handleX, handleY) : -1
- visible: pressed || (edit.hasSelection
+ visible: pressed || ((edit.cursorVisible || edit.hasSelection)
&& posInViewport.y + handleHeight >= -1
&& posInViewport.y <= viewport.height + 1
&& posInViewport.x + handleWidth >= -1