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

QDesktopWidget::primaryScreenChanged & QScreen::availableGeometryChanged do not get triggered consistently

    XMLWordPrintable

Details

    • Linux/X11, Windows

    Description

      I am trying to find a way to have my Qt app signaled when the user moves it from one monitor to another monitor. This is necessary to handle changes in screen sizes and dpi.
      Unfortunately, the only two things that I have found that might help here do not consistently produce a signal. I have only tried Ubuntu, not Windows nor MacOSX

      void
      MainGUIImpl::fileOpenInterfShow()

      { ... QDesktopWidget* theDTWidget = qApp->desktop(); QGuiApplication* theGuiApp = dynamic_cast<QGuiApplication*>(qApp); connect(theDTWidget, &QDesktopWidget::primaryScreenChanged, this, &MainGUIImpl::mainGUIPrimaryScreenChanged); connect(theGuiApp->primaryScreen(), &QScreen::availableGeometryChanged, this, &MainGUIImpl::mainGUIAvailGeomChanged); ... }

      // End of MainGUIImpl::fileOpenInterfShow()

      void MainGUIImpl::mainGUIAvailGeomChanged(const QRect &newqrect)

      { fprintf(stderr,"AVAILABLE GUI SIZE CHANGED TO: [%d,%d,%d,%d]\n", newqrect.x(),newqrect.y(),newqrect.width(),newqrect.height()); }

      void MainGUIImpl::mainGUIPrimaryScreenChanged()

      { fprintf(stderr,"MAIN GUI SCREEN CHANGED\n"); }

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            daveb David Baumgartner
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes