diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2018-02-14 14:23:18 +0200 |
---|---|---|
committer | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2018-04-04 17:23:27 +0000 |
commit | 27696915b7977e245082dbb534d36f2165437378 (patch) | |
tree | a8e95c7ab34f65f87ef3b3534007652c620b5427 /src | |
parent | 5f1b15d2c54a6930cf8164598f1d540840540540 (diff) |
Fix emitting keyboardRectangle
keyboardRectangle was not correct because the binding was in
the wrong place.
This change moves the binding to InputPanel, which then can map
the keyboard location to itself, or to root item.
Change-Id: I471df13d5381ec9b0e1b80369590bc608d17ae91
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/virtualkeyboard/content/InputPanel.qml | 14 | ||||
-rw-r--r-- | src/virtualkeyboard/content/components/Keyboard.qml | 11 |
2 files changed, 16 insertions, 9 deletions
diff --git a/src/virtualkeyboard/content/InputPanel.qml b/src/virtualkeyboard/content/InputPanel.qml index ec771c4e..e41756a7 100644 --- a/src/virtualkeyboard/content/InputPanel.qml +++ b/src/virtualkeyboard/content/InputPanel.qml @@ -111,6 +111,9 @@ Item { /*! \internal */ property alias keyboard: keyboard + /*! \internal */ + readonly property bool __isRootItem: inputPanel.parent != null && inputPanel.parent.parent == null + SelectionControl { objectName: "selectionControl" x: -parent.x @@ -130,4 +133,15 @@ Item { anchors.fill: keyboard enabled: active } + + Binding { + target: InputContext + property: "keyboardRectangle" + value: mapToItem(null, + __isRootItem ? keyboard.x : x, + (__isRootItem ? keyboard.y : y) + keyboard.wordCandidateView.currentYOffset - (keyboard.shadowInputControl.visible ? keyboard.shadowInputControl.height : 0), + keyboard.width, + keyboard.height - keyboard.wordCandidateView.currentYOffset + (keyboard.shadowInputControl.visible ? keyboard.shadowInputControl.height : 0)) + when: !InputContext.animating + } } diff --git a/src/virtualkeyboard/content/components/Keyboard.qml b/src/virtualkeyboard/content/components/Keyboard.qml index 5a2e76eb..ce02d406 100644 --- a/src/virtualkeyboard/content/components/Keyboard.qml +++ b/src/virtualkeyboard/content/components/Keyboard.qml @@ -40,6 +40,8 @@ Item { objectName: "keyboard" property alias style: styleLoader.item + property alias wordCandidateView: wordCandidateView + property alias shadowInputControl: shadowInputControl property var activeKey: null property TouchPoint activeTouchPoint property int localeIndex: -1 @@ -470,15 +472,6 @@ Item { } Binding { target: InputContext - property: "keyboardRectangle" - value: Qt.rect(keyboard.x, - keyboard.y + wordCandidateView.currentYOffset - (shadowInputControl.visible ? shadowInputControl.height : 0), - keyboard.width, - keyboard.height - wordCandidateView.currentYOffset + (shadowInputControl.visible ? shadowInputControl.height : 0)) - when: keyboard.active && !InputContext.animating - } - Binding { - target: InputContext property: "previewRectangle" value: characterPreview.previewRect when: characterPreview.visible |