Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-138685

Phantom Item's width changes using QSettings and iOS on landscape during startup

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.8.3
    • None
    • iOS devices (both iPads and iPhones) on landscape
    • iOS/tvOS/watchOS

      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.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            tomasmizera Tomas Mizera
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes