aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2021-01-19 10:33:05 +0200
committerJarkko Koivikko <jarkko.koivikko@code-q.fi>2021-03-04 12:26:55 +0200
commited820383941b68f1fe244895e73ee61ba87c4377 (patch)
treeb82e1d2fc97f61d23cfc64677eeee2a3b80db997
parent3866fb086f9bed844b1768cd1b95d798e8cbf7ef (diff)
Fix position of the keyboardRectangle in app integrationv5.12.11
InputPanel contained double mapping of keyboardRectangle to QML root. The problem was that inputPanel.x and y were already relative to parent so mapToItem(null) doubled the value. Use function to calculate the rectangle. This function also references the position of the inputPanel, so it is properly updated in the Binding. Task-number: QTBUG-85554 Change-Id: Iaf5075f31f27bc08bbf41aa5960303705135cd16 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 40928827d166649afa1b256e7b05dcd11442d25a)
-rw-r--r--src/virtualkeyboard/content/InputPanel.qml21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/virtualkeyboard/content/InputPanel.qml b/src/virtualkeyboard/content/InputPanel.qml
index b32ac340..ec2887de 100644
--- a/src/virtualkeyboard/content/InputPanel.qml
+++ b/src/virtualkeyboard/content/InputPanel.qml
@@ -124,6 +124,7 @@ Item {
implicitHeight: keyboard.height
Keyboard {
id: keyboard
+ readonly property real yOffset: keyboard.wordCandidateView.currentYOffset - (keyboard.shadowInputControl.visible ? keyboard.shadowInputControl.height : 0)
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
@@ -137,11 +138,21 @@ Item {
Binding {
target: InputContext.priv
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))
+ value: keyboardRectangle()
when: !InputContext.animating
}
+
+ /*! \internal */
+ function keyboardRectangle() {
+ var rect = Qt.rect(0, keyboard.yOffset, keyboard.width, keyboard.height - keyboard.yOffset)
+ if (__isRootItem) {
+ rect.x += keyboard.x
+ rect.y += keyboard.y
+ }
+ // Read the inputPanel position.
+ // This ensures that the Binding works.
+ var unusedX = inputPanel.x
+ var unusedY = inputPanel.y
+ return mapToItem(null, rect.x, rect.y, rect.width, rect.height)
+ }
}