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

QGuiApplication::screens() returns only the secondary screen

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.5.2, 6.6.0 Beta1, 6.7.0 FF
    • 6.2.4
    • QPA: Windows
    • None
    • Windows 10
    • Windows
    • f4d6d0489 (dev), b7053fc2b (6.5), e14fe5f84 (6.6)

    Description

      I have 2 identical monitors connected to a Window 10 PC.
      Both monitors show the same name in the windows display settings (Q2790).


      QGuiApplication::screens() only returns one (the secondary monitor) causing a lot of weird problems.

      • Main Window Menu Pops up on the secondary, while the main window is on the primary screen
      • Message boxes popping up on the secondary screen
      • New Windows placed on the secondary screen

      The problem seems to be caused by a problem within  QWindowsScreenManager::handleScreenChanges()

       

      bool QWindowsScreenManager::handleScreenChanges()
      {
          // Here both Monitors are in the list
          const WindowsScreenDataList newDataList = monitorData();
      
          const bool lockScreen = newDataList.size() == 1 && (newDataList.front().flags & QWindowsScreenData::LockScreen);
          bool primaryScreenChanged = false;
          for (const QWindowsScreenData &newData : newDataList) {
              // due to both monitors have the same name, the primary screen gets 
              // overwritten by the secondary monitor
              const int existingIndex = indexOfMonitor(m_screens, newData.name);
              if (existingIndex != -1) {
                  m_screens.at(existingIndex)->handleChanges(newData);
                  if (existingIndex == 0)
                      primaryScreenChanged = true;
              } else {
       

       

       

      The problem is not present on Qt 5.12.12.
      I will try to rename one of the monitors to workaround the problem.

      Attachments

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

        Activity

          People

            timothee.keller Timothée Keller (Inactive)
            mohrm Magnus Moehr
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes