aboutsummaryrefslogtreecommitdiffstats
path: root/src/virtualkeyboard/content/components/SelectionControl.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/virtualkeyboard/content/components/SelectionControl.qml')
-rw-r--r--src/virtualkeyboard/content/components/SelectionControl.qml27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/virtualkeyboard/content/components/SelectionControl.qml b/src/virtualkeyboard/content/components/SelectionControl.qml
index a24c1116..125a8eb7 100644
--- a/src/virtualkeyboard/content/components/SelectionControl.qml
+++ b/src/virtualkeyboard/content/components/SelectionControl.qml
@@ -33,18 +33,19 @@ import QtQuick.VirtualKeyboard 2.1
Item {
id: root
property bool handleIsMoving: false
- visible: InputContext.selectionControlVisible || handleIsMoving
+ property var inputContext: InputContext
+ visible: enabled && (inputContext.selectionControlVisible || handleIsMoving) && !InputContext.animating
Loader {
id: anchorHandle
sourceComponent: keyboard.style.selectionHandle
- x: visible ? Qt.inputMethod.anchorRectangle.x - width/2 : 0
- y: visible ? Qt.inputMethod.anchorRectangle.y + Qt.inputMethod.anchorRectangle.height : 0
+ x: visible ? inputContext.anchorRectangle.x - width/2 : 0
+ y: visible ? inputContext.anchorRectangle.y + inputContext.anchorRectangle.height : 0
Behavior on opacity {
NumberAnimation { duration: 200 }
}
- opacity: InputContext.anchorRectIntersectsClipRect ? 1.0 : 0.0
+ opacity: inputContext.anchorRectIntersectsClipRect ? 1.0 : 0.0
MouseArea {
width: parent.width * 2
@@ -55,10 +56,10 @@ Item {
// The middle of a handle is mapped to the middle of the line above it
root.handleIsMoving = true
var xx = x + anchorHandle.x + mouse.x
- var yy = y + anchorHandle.y + mouse.y - (anchorHandle.height + Qt.inputMethod.anchorRectangle.height)/2
+ var yy = y + anchorHandle.y + mouse.y - (anchorHandle.height + inputContext.anchorRectangle.height)/2
var x2 = cursorHandle.x + cursorHandle.width/2
- var y2 = cursorHandle.y - Qt.inputMethod.cursorRectangle.height/2
- InputContext.setSelectionOnFocusObject(Qt.point(xx,yy), Qt.point(x2,y2))
+ var y2 = cursorHandle.y - inputContext.cursorRectangle.height/2
+ inputContext.setSelectionOnFocusObject(Qt.point(xx,yy), Qt.point(x2,y2))
}
onReleased: {
root.handleIsMoving = false
@@ -70,13 +71,13 @@ Item {
Loader {
id: cursorHandle
sourceComponent: keyboard.style.selectionHandle
- x: visible ? Qt.inputMethod.cursorRectangle.x - width/2 : 0
- y: visible ? Qt.inputMethod.cursorRectangle.y + Qt.inputMethod.cursorRectangle.height : 0
+ x: visible ? inputContext.cursorRectangle.x - width/2 : 0
+ y: visible ? inputContext.cursorRectangle.y + inputContext.cursorRectangle.height : 0
Behavior on opacity {
NumberAnimation { duration: 200 }
}
- opacity: InputContext.cursorRectIntersectsClipRect ? 1.0 : 0.0
+ opacity: inputContext.cursorRectIntersectsClipRect ? 1.0 : 0.0
MouseArea {
width: parent.width * 2
@@ -86,10 +87,10 @@ Item {
// we don't move the handles, the handles will move as the selection changes.
root.handleIsMoving = true
var xx = anchorHandle.x + anchorHandle.width/2
- var yy = anchorHandle.y - Qt.inputMethod.anchorRectangle.height/2
+ var yy = anchorHandle.y - inputContext.anchorRectangle.height/2
var x2 = x + cursorHandle.x + mouse.x
- var y2 = y + cursorHandle.y + mouse.y - (cursorHandle.height + Qt.inputMethod.cursorRectangle.height)/2
- InputContext.setSelectionOnFocusObject(Qt.point(xx, yy), Qt.point(x2, y2))
+ var y2 = y + cursorHandle.y + mouse.y - (cursorHandle.height + inputContext.cursorRectangle.height)/2
+ inputContext.setSelectionOnFocusObject(Qt.point(xx, yy), Qt.point(x2, y2))
}
onReleased: {
root.handleIsMoving = false