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

the "virtualGeometryChanged" signal is triggered multiple times

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.1.0, 6.2.0 Beta1
    • QPA: X11/XCB
    • None
    • Linux/X11

    Description

      [Code] 

      #include "mainwindow.h"
      #include <QScreen>
      #include <QGuiApplication>
      #include <QDebug>
      #include <QTime>
      
      MainWindow::MainWindow(QWidget *parent)
          : QMainWindow(parent)
      
      {
      #if 1
          connect(QGuiApplication::primaryScreen(), &QScreen::virtualGeometryChanged, [=] () {
              qInfo() << QTime::currentTime().toString("hh:mm:ss:zzz");
          });
      #else
          QGuiApplication::primaryScreen()->setOrientationUpdateMask( Qt::LandscapeOrientation | Qt::PortraitOrientation);
          connect(QGuiApplication::primaryScreen(), &QScreen::orientationChanged, [=] () {
              qInfo() << QTime::currentTime().toString("hh:mm:ss:zzz");
          });
      #endif
      
      }
      
      MainWindow::~MainWindow()
      {
      
      }
      
      

      [Steps]

      1.  Run the sample program
      2.  Rotate screen
      3. Then you'll see that the signal(virtualGeometryChanged) will be trigger multiple times(twice),but the other signal(orientationChanged) is normal.

      [Hope]

      • I don't understand why  the signal named "virtualGeometryChanged" is triggered twice. Is there any special reason? What I think is that when the screen rotates, it only needs to trigger the signal once.

      Attachments

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

        Activity

          People

            liaqi Liang Qi
            fanruijie Alan Fan
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change