From abbfc9fea93e5e72b6669d0cd086f7ba21805578 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Fri, 27 Mar 2020 15:10:47 +0200 Subject: Better handling of VKB when screen is rotated Resize and reposition the Qt Virtual Keyboard based on the display orientation. Contains workaround values for the aligment when display is in portrait mode, as VKB does not align itself as you would expect. Task-number: QTBUG-83217 Change-Id: I99f9cd332f61850d1a47b2efba335242f8d82e89 Reviewed-by: Kari Oikarinen --- qml/MainWindow.qml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/qml/MainWindow.qml b/qml/MainWindow.qml index c1f4e54..686dd87 100644 --- a/qml/MainWindow.qml +++ b/qml/MainWindow.qml @@ -275,10 +275,16 @@ Item { InputPanel { id: inputPanel z: 99 - y: root.height - anchors.left: root.left - anchors.right: root.right - visible: y < root.height + x: root.portraitMode ? + (globalSettings.rotationSelected ? + inputPanel.height + root.height : -inputPanel.height - root.height) : + 0 + y: root.portraitMode ? + (globalSettings.rotationSelected ? inputPanel.height : inputPanel.height) : + (globalSettings.rotationSelected ? -root.height : root.height) + width: root.portraitMode ? window.height : window.width + rotation: root.rotation + property real alignmentWorkaround: height * 0.1 onActiveChanged: { if (!active) applicationLoader.anchors.topMargin = 0; @@ -296,7 +302,14 @@ Item { when: inputPanel.active PropertyChanges { target: inputPanel - y: root.height - inputPanel.height + x: root.portraitMode ? + (globalSettings.rotationSelected ? + root.height - inputPanel.height * 2 - inputPanel.alignmentWorkaround : + -inputPanel.height - inputPanel.alignmentWorkaround) : + 0 + y: root.portraitMode ? + inputPanel.height + inputPanel.alignmentWorkaround : + (globalSettings.rotationSelected ? 0 : root.height - inputPanel.height) } } @@ -305,6 +318,11 @@ Item { to: "visible" reversible: true ParallelAnimation { + NumberAnimation { + properties: "x" + duration: 250 + easing.type: Easing.InOutQuad + } NumberAnimation { properties: "y" duration: 250 -- cgit v1.2.3