-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.8.3
-
None
-
iOS devices (both iPads and iPhones) on landscape
We found a weird bug when upgrading our app to 6.8.3 (from 6.6.3).
When starting up the app on iOS in the landscape mode, objects whose implicitWidth is bound to the ApplicationWindow's width, are not painted on the whole window. Their width is of the windows's height size. It seems as if the information about screen rotation did not propagate to those objects.
This is what you see when opening the app on landscape (note that the red drawer do not span the whole width of the window):
Once the screen is rotated back and forth, the drawer is rendered correctly:
We found out that this happens only if we use `QML Settings` to store the main window's x, y, width and height attributes via property aliases (as suggested here: https://doc.qt.io/qt-6/qml-qtcore-settings.html). If I comment out the `Settings` object, the app opens correctly.
I am attaching a demo app to test this out. It can be reproduced on any iOS device - just open the demo app in the landscape mode. I did not manage to reproduce this on other platforms (tried MacOS and Android).
When starting the app in portrait mode, screen width propagates as follows:
qml: --> Window width changed: 820 qml: --> Drawer width changed: 820 qml: --> Drawer implicitWidth changed: 820 qml: --> Window height changed: 1180
However, when the app is opened in the landscape mode, property changes go like this:
qml: --> Window width changed: 1180 qml: --> Drawer width changed: 1180 qml: --> Drawer implicitWidth changed: 1180 qml: --> Window height changed: 820 qml: --> Drawer width changed: 820 <-- weird!
As you can see, for some reason, drawer receives additional information that it's width should be 820 (the size of the window's height).
I am happy to provide more details if needed. It is a bit hard to explain 😮💨
Initially, we fixed this by automatically rotating the screen on startup to portrait (ugly ux!). After realizing this is caused by the use of QML Settings, we replaced QML Settings with QSettings (cpp) and store the x/y/width/height properties onChange ourselves. We then use those values as default ones when starting the app. This seems to be working properly. We store the window position and size because the app can run on desktop.