Commit 9f4ff8ce authored by J-P Nurmi's avatar J-P Nurmi
Browse files

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: default avatarMitch Curtis <mitch.curtis@digia.com>
Reviewed-by: default avatarRichard Moe Gustavsen <richard.gustavsen@digia.com>
Showing with 4 additions and 3 deletions
...@@ -75,7 +75,7 @@ Loader { ...@@ -75,7 +75,7 @@ Loader {
MouseArea { MouseArea {
id: mouse id: mouse
anchors.fill: item anchors.fill: item
enabled: handle.active enabled: item && item.visible
preventStealing: true preventStealing: true
property real pressX property real pressX
property point offset property point offset
......
...@@ -170,7 +170,7 @@ TextInput { ...@@ -170,7 +170,7 @@ TextInput {
x: mappedPos.x x: mappedPos.x
y: mappedPos.y 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: { onPositionChanged: {
if (!input.blockRecursion) { if (!input.blockRecursion) {
......
...@@ -45,6 +45,7 @@ Item { ...@@ -45,6 +45,7 @@ Item {
y: -20 y: -20
width: 80 width: 80
height: knob.height + knobLine.height + 60 height: knob.height + knobLine.height + 60
visible: styleData.hasSelection
Rectangle { Rectangle {
id: knob id: knob
......
...@@ -933,7 +933,7 @@ ScrollView { ...@@ -933,7 +933,7 @@ ScrollView {
property var posInViewport: flickableItem.contentX !== flickableItem.contentY !== Number.MAX_VALUE ? property var posInViewport: flickableItem.contentX !== flickableItem.contentY !== Number.MAX_VALUE ?
parent.mapToItem(viewport, handleX, handleY) : -1 parent.mapToItem(viewport, handleX, handleY) : -1
visible: pressed || (edit.hasSelection visible: pressed || ((edit.cursorVisible || edit.hasSelection)
&& posInViewport.y + handleHeight >= -1 && posInViewport.y + handleHeight >= -1
&& posInViewport.y <= viewport.height + 1 && posInViewport.y <= viewport.height + 1
&& posInViewport.x + handleWidth >= -1 && posInViewport.x + handleWidth >= -1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment