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

QApplication::desktop()->screenNumber() returns incorrect screen number

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.6.0 RC
    • 5.5.0, 5.6.0 Alpha
    • GUI: Window management
    • OpenSuse 13.2 32bit
    • a6b2a4642f07cd6e52b447e1e441b257990a8d0

    Description

      For a multi screen setup (seperate X screens, not Xinerama or RandR) Qt 5 does not return the correct screen number for the scond screen when calling QApplication::desktop()->screenNumber().

      int screenCount = QApplication::desktop()->screenCount();
      qDebug() << "screen count" << screenCount;
      
      for (int i = 0; i < screenCount; ++i) {
          QWidget *widget = QApplication::desktop()->screen(i);
          int reverseScreenNr = QApplication::desktop()->screenNumber(widget);
          qDebug() << "root widget for screen" << i << widget << "reverse nr:" << reverseScreenNr;
      }
      

      While Qt 4 prints

      screen count 2 
      root widget for screen 0 QDesktopWidget(0x9b46148) reverse nr: 0 
      root widget for screen 1 QWidget(0x9b4e250) reverse nr: 1
      

      as expected Qt 5 returns a reverse screen number of 0 instead of 1

      screen count 2
      root widget for screen 0 QDesktopScreenWidget(0x8f02798) reverse nr: 0
      root widget for screen 1 QDesktopScreenWidget(0x8f01278) reverse nr: 0
      

      Attachments

        1. desktopwidgt.cpp
          0.5 kB
        2. qtbug48545.zip
          0.9 kB

        Issue Links

          Activity

            People

              srutledg Shawn Rutledge
              berres Armin Berres
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: