Details

    • Technical task
    • Resolution: Done
    • Not Evaluated
    • 6.0
    • GUI: Window management
    • None
    • c54a5b83804c00474d141b485b752a7c54169ebf (qt/qtbase/dev)

    Description

      We want to get rid of QDesktopWidget, so we also need to provide an alternative to creating toplevel windows with a QDesktop(Screen)Widget as the parent in order to have them created on the correct screen.

      Assuming a virtual desktop with two screens, 0 to the left and 1 to the right. Code like:

      QWidget *topLevel = new QWidget;
      topLevel->setScreen(QGuiApplication::screens().at(0));
      topLevel->show();
      

      This should make the toplevel window open up on the presumably left-most screen, no matter if

      • screen 0 is part of a virtual desktop group
      • there are other application windows already open on another screen
      • the mouse cursor is on the second screen

      Maximizing the window should maximize it on that screen; restoring it should bring it back to the previous position on that screen. The widget should have the devicePixelRatio of screen 0.

      While the toplevel widget is visible, calling

      toplevel->setScreen(QGuiApplication::screens().at(1));
      

      should NOT move the visible window to the second screen. However, maximizing the window should now fill the second screen; restoring it from there should restore it back to the previous geometry.

      Assuming a multi-head setup, ie. no virtual desktop (and only relevant on X11 or Wayland), both calls to QWidget::setScreen should result in the window being placed on the second screen.

      Qt has QWindow::setScreen, but QWidget typically doesn't return a valid QWindow from windowHandle() until it's "too late", ie until the widget is becoming visible.

      Attachments

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

        Activity

          People

            vhilshei Volker Hilsheimer
            vhilshei Volker Hilsheimer
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes