aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2021-06-03 13:34:21 +0300
committerJarkko Koivikko <jarkko.koivikko@code-q.fi>2021-06-03 16:36:16 +0300
commit44ed5e1e2c35293e34331fa8a629d642a5877a2f (patch)
treea9b312ee841e8fc87c6c282894ba2851e3f89249 /src
parentc86cdf76825a19c4ca3fdc498f60266c1e1af0ff (diff)
Make sure keyboard layout observer returns correct geometry
The scanLayout() function may be called at any time, even during the layout process. This means, that some parts of the layout may overlap the layout geometry. The user (e.g. the XT9 layout engine) reports an error if any of the keys overlap the layout geometry. This change adjusts the geometry of the reported layout if necessary. Change-Id: I8d2ccec695484518c650a29da33e02de5e513126 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/virtualkeyboard/content/components/KeyboardLayout.qml10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/virtualkeyboard/content/components/KeyboardLayout.qml b/src/virtualkeyboard/content/components/KeyboardLayout.qml
index 997343db..14e5e8eb 100644
--- a/src/virtualkeyboard/content/components/KeyboardLayout.qml
+++ b/src/virtualkeyboard/content/components/KeyboardLayout.qml
@@ -83,6 +83,8 @@ import QtQuick.VirtualKeyboard
*/
ColumnLayout {
+ id: root
+
/*! Sets the input method to be used in this layout.
This property allows a custom input method to be
@@ -148,8 +150,8 @@ ColumnLayout {
function scanLayout() {
var layout = {
- width: parent.width,
- height: parent.height,
+ width: root.width,
+ height: root.height,
keys: []
}
__scanLayoutRecursive(this, layout)
@@ -173,6 +175,10 @@ ColumnLayout {
isFunctionKey: child.functionKey,
noKeyEvent: child.noKeyEvent
}
+ if (key.left + key.width > layout.width)
+ layout.width = key.left + key.width
+ if (key.top + key.height > layout.height)
+ layout.height = key.top + key.height
layout.keys.push(key)
} else {
__scanLayoutRecursive(child, layout)