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

Primary orientation isn't updated after rotating screen

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.1
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      Linux/X11

      Description

       

      //demo
      
      #include <QApplication>
      #include <QDebug>
      #include <QTimer>
      #include <QScreen>
      
      int main(int argc,char* argv[])
      {
          if (!qgetenv("QT_SCREEN_SCALE_FACTORS").isEmpty()) {
              qDebug() << qgetenv("QT_SCREEN_SCALE_FACTORS");
              qunsetenv("QT_SCREEN_SCALE_FACTORS");
          }
          QApplication a(argc,argv);
          QTimer t;
          t.connect(&t,&QTimer::timeout,[](){
              auto screen = qApp->primaryScreen();
              auto orientation = screen->primaryOrientation();
              qDebug() << "primaryOrientation" << orientation;
          });
          t.start(500);
          return a.exec();
      }
      

      Run this code,and use "xrandr -o left" to rotate screen.

      the output is always "LandscapeOrientation", and the expected results should be changed to "PortraitOrientation".

       

        Attachments

        For Gerrit Dashboard: QTBUG-88554
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            zhangyu yu zhang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There is 1 open Gerrit change