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

Android reports incorrect screen size after rotation

XMLWordPrintable

    • Android
    • 7a9bc220c (dev)
    • Team One Foundation Sprint 52, Team A Foundation Sprint 53

      I use QScreen::orientationChanged() signal to detect screen rotation on Android device.

      The signal is emitted normally and reports a correct orientation. However, when I try to request the actual screen size, I see some inconsistency.

      I thought that I might have to wait for the resizeEvent(), to get the updated screen size, but it is also inconsistent.

      See the log below:

       

      1. resizeEvent() QSize(833, 387) Screen size: QSize(914, 411)
      2. Orientation change: Qt::LandscapeOrientation Screen size: QSize(914, 411)
      3. resizeEvent() QSize(881, 411) Screen size: QSize(411, 914)
      4. Orientation change: Qt::PortraitOrientation Screen size: QSize(411, 914)
      5. resizeEvent() QSize(411, 833) Screen size: QSize(411, 914)
      6. Orientation change: Qt::LandscapeOrientation Screen size: QSize(411, 914)
      7. resizeEvent() QSize(411, 890) Screen size: QSize(914, 411)
      8. resizeEvent() QSize(833, 387) Screen size: QSize(914, 411)
      

      As it can be seen from lines 4 and 6, the screen size for the Portrait and Landscape orientation is reported to be the same (which is, of course, incorrect).

      Also lines 3 and 7 show inconsistency in the widget size reported by resizeEvent, and the screen size.

      I'm attaching a simple project to reproduce the issue.

       

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

            ivan.solovev Ivan Solovev
            ivan.solovev Ivan Solovev
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: