aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2022-09-28 13:18:58 +0300
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-09-29 05:38:05 +0000
commitb3dd76b601ae40556135fa78e39093d573e8b8b5 (patch)
treee8509b9f4f572ca33fc0be769bd44bd3091c59cf
parent5005bd5d8ccf1ca6699e6230d734d274bc4dc516 (diff)
Fix screen orientation handling for basic-b2qt example
Since Qt 6.2.2 the InputPanel is not reparented anymore for modal dialogs. The basic example contains code to handle orientation for this case. Now, it is enough to handle orientation at the application window level. The InputPanel orientation will follow this automatically. In addition, for QTBUG-106895, the example uses Screen.orientation instead Screen.primaryOrientation to detect landscape orientation. It seems on Mac the Screen.orientation can be Qt.PrimaryOrientation, which was incorrectly handled as portrait orientation. Fixes: QTBUG-106895 Task-number: QTBUG-83217 Change-Id: Ic40d9194150334f31a236f0b6af84d59f914759c Reviewed-by: Lorn Potter <lorn.potter@gmail.com> (cherry picked from commit 7c622a672117ca6c89839d9da8fb4c5cb3c3e102) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--examples/virtualkeyboard/basic/basic-b2qt.qml15
1 files changed, 8 insertions, 7 deletions
diff --git a/examples/virtualkeyboard/basic/basic-b2qt.qml b/examples/virtualkeyboard/basic/basic-b2qt.qml
index a2bb79a6..aebabd2e 100644
--- a/examples/virtualkeyboard/basic/basic-b2qt.qml
+++ b/examples/virtualkeyboard/basic/basic-b2qt.qml
@@ -15,8 +15,8 @@ Item {
Item {
id: appContainer
- width: Screen.orientation === Qt.LandscapeOrientation ? parent.width : parent.height
- height: Screen.orientation === Qt.LandscapeOrientation ? parent.height : parent.width
+ width: inLandscapeOrientation ? parent.width : parent.height
+ height: inLandscapeOrientation ? parent.height : parent.width
anchors.centerIn: parent
Basic {
id: virtualKeyboard
@@ -83,12 +83,12 @@ Item {
id: inputPanel
z: 89
y: yPositionWhenHidden
- x: Screen.orientation === Qt.LandscapeOrientation ? 0 : (parent.width-parent.height) / 2
- width: Screen.orientation === Qt.LandscapeOrientation ? parent.width : parent.height
+ x: 0
+ width: parent.width
- keyboard.shadowInputControl.height: (Screen.orientation === Qt.LandscapeOrientation ? parent.height : parent.width) - keyboard.height
+ keyboard.shadowInputControl.height: parent.height - keyboard.height
- property real yPositionWhenHidden: Screen.orientation === Qt.LandscapeOrientation ? parent.height : parent.width + (parent.height-parent.width) / 2
+ property real yPositionWhenHidden: parent.height
states: State {
name: "visible"
@@ -136,7 +136,8 @@ Item {
}
- property bool inLandscapeOrientation: Screen.orientation === Qt.LandscapeOrientation
+ property bool inLandscapeOrientation: Screen.primaryOrientation === Qt.LandscapeOrientation ||
+ Screen.primaryOrientation === Qt.InvertedLandscapeOrientation
Binding {
target: appContainer.Window.window !== null ? appContainer.Window.window.contentItem : null