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

Screen.desktopAvailableHeight and Width inconsistent results between Android and iOS

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.8.0
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      iOS 9.3.5 and iOS 10.3.1, various Android Versions.
    • Platform/s:
      iOS/tvOS/watchOS

      Description

      The following piece of code lands incoherent results between Android and iOS when rotating a phone, with iOS likely being wrong:

      QML
      import QtQuick.Window 2.2
      
      Rectangle {
          id: sceneRect
          anchors.fill: parent
          
          Flickable {
              id: mainFlickable
              anchors.fill: parent
              
              ListView: {
                  id: // something
                  width: parent.width
                  height: // something
                  x: // something
                  y: // something
      
                  onWidthChanged: {
                      if (Screen.desktopAvailableHeight > Screen.desktopAvailableWidth) {
                          console.log("a");
                      } else {
                          console.log("b");
                      }
                  }
              }
          }
      }
      

      Additional Information:
      The QML file with this code is loaded via a Loader element into a Window Element that has width: Screen.desktopAvailableWidth and height: Screen.desktopAvailableHeight.

      Expected outcome:
      "a" to be logged when the phone or tablet is switched to portrait mode, "b" to be logged when the phone or tablet is switched to landscape mode.

      Outcome result:
      Portrait mode: "a" on Android, "b" on iOS.
      Landscape mode: "b" on Android, "a" on iOS.

      Temporal workaround:
      Interestingly enough, changing the set width of the ListView to Screen.desktopAvailableWidth (from parent.width), which should be identical in this case, solves the problem on iOS. No change on Android (as it was working anyways).

        Attachments

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

          Activity

            People

            Assignee:
            srutledg Shawn Rutledge
            Reporter:
            Aerius Nils Dorando
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes