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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.5.0, 5.6.0 Alpha
    • Fix Version/s: 5.6.0 RC
    • Component/s: GUI: Window management
    • Labels:
    • Environment:
      OpenSuse 13.2 32bit
    • Commits:
      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

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

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes