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

    • 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

        1. qtbug81027_ipad_screenshot.png
          179 kB
          Nahomi Gröhn
        2. qtbug81027.zip
          5 kB
          Nahomi Gröhn
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes