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

    Details

    • Platform/s:
      iOS/tvOS/watchOS

      Description

      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.

        Attachments

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

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            nagrohn Nahomi Gröhn
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes