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

QGuiApplication::screens() does not update geometry after screen arrangement

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.11, 5.15.10
    • Widgets: Main Window
    • None
    • Qt 5.15.11
      Windows 11 22H2
    • Windows

    Description

      QWindow::screen()->geometry() does not update for second screen rearrangement.

       

      Steps to reproduce:

      1. create analogclock sample project
      2. add
        bool AnalogClockWindow::nativeEvent(const QByteArray &eventType, void *message, long *result){
            MSG *msg = static_cast<MSG *>(message);
            switch (msg->message)
            {
            case WM_SIZE:
            {
                QScreen* screen = this->screen();
                QRect screenGeo = screen->geometry();
                QRect curGeo = this->geometry();
                bool curInScreen = screenGeo.contains(curGeo);
                qDebug()<<"curInScreen"<<curInScreen;
                break;
            }
            }
        
            return RasterWindow::nativeEvent(eventType, message, result);
        }
      1. run program
      2. open System Settings > System > Display
      3. move second display to another side > apply
      4. move second display back > apply
      5. move program to second display
      6. when resize program, curInScreen become false because screen->geometry() stays at the value of first rearrangement

       

       

      Attachments

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            chrisho Chris Ho
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: