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

Specified target screen for window is ignored

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8
    • GUI: Window management
    • None
    • Fedora 41, KDE Plasma
    • Linux/Wayland

    Description

      Consider this QML code:

       

      import QtQuick
      
      Window {
          screen: Qt.application.screens[0]
          Component.onCompleted: showFullScreen()
          Rectangle {
              color: "red"
              anchors.fill: parent
          }
      } 

      The goal is to show a fullscreen window on a particular screen.

       

      However it does not work as expected. The window always opens on a specific screen, regardless of which screen index is picked.

      This is caused by the lines https://invent.kde.org/qt/qt/qtbase/-/blob/dev/src/gui/kernel/qwindow.cpp#L562-563

       

      if (QScreen *screen = screenForGeometry(geometry))
          setTopLevelScreen(screen, false);
      

      This is called after the initial setScreen from QML and overrides it. screenForGeometry() can't work on Wayland, so the result will be wrong.

      It can be worked around by calling show() before setting the screen

       

      Attachments

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

        Activity

          People

            vestbo Tor Arne Vestbø
            nicolasfella_kde Nicolas Fella
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes