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

Using Screen class to calculate/set width and height brings strange behavior when the app returns to foreground

XMLWordPrintable

    • iOS/tvOS/watchOS

      With the code below, the app doesn't fill the entire screen when it comes back from background to foreground. ( qtbug81027_ipad_screenshot.png )

      main.cpp

      QQuickView view;
      view.setResizeMode(QQuickView::SizeRootObjectToView);
      ...
      

      main.qml

      Rectangle {
          id: app
          visible: true
      
          property var i : Screen.width >= 0 ? 1 : 1
      
          width: 640 * i
          height: 480 * i
       ...
      }
      

      The same behavior occurs at least with Screen.height and Screen.logicalPixelDensity.

      How to reproduce:
      1. Run the sample code (qtbug81027.zip) on iPad
      2. Put the app to the background (by pressing home button)
      3. Bring the app to foreground

      Result :
      The app does not fill the entire screen (qtbug81027_ipad_screenshot.png)

      Workaround ?
      Modify var to some other type e.g. int or real enables the app to fill the entire screen when it returns to foreground.

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

            vhilshei Volker Hilsheimer
            nagrohn Nahomi Gröhn (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes