Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Bring Window to the 2nd Monitor
Forum Updated to NodeBB v4.3 + New Features

Bring Window to the 2nd Monitor

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 2 Posters 298 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cbens
    wrote on 16 Apr 2025, 14:57 last edited by
    #1

    I have 2 Monitors and want to put a Window to let's say Monitor 2. The following Example works perfect compiled with Qt 5.15.2. The window appears on the monitor I defined. But with Qt 6.7.3 it always appears on the Monitor I started the Application from.
    (Using Rocky 9.4 Linux, Gnome 40.4, Wayland)

    import QtQuick 2.15
    import QtQuick.Window 2.15
    
    Window {
        screen: Qt.application.screens[1]   // Monitor to show Window
    
        x: screen.virtualX
        y: screen.virtualY
    
        width: 640
        height: 480
        visible: true
        title: qsTr("Hello World")
    }
    
    1 Reply Last reply
    1
    • C Offline
      C Offline
      cbens
      wrote on 24 Apr 2025, 12:44 last edited by
      #2

      In the meantime I have found a workaround which only works for full screen.

      Window {
          width: 640
          height: 480
          visible: false
          title: qsTr("Hello World")
      
          //x: 0   // Show on left Monitor
          x: 2000   // Show on right Monitor
      
      
          Component.onCompleted: {
              showFullScreen()   // show Window on left or right Monitor (depending on x)
              //showMaximized()  // shows window always on Monitor where I started the app
              //showNormal()   // shows window always on Monitor where I started the app
              //show()         // shows window always on Monitor where I started the app
          }
      }
      

      (Same on RockyLinux 9.5 and Qt 6.8.3)

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cbens
        wrote on 29 Apr 2025, 10:51 last edited by
        #3

        Same with Fedora 42, Gnome 48

        J 1 Reply Last reply 29 Apr 2025, 10:57
        0
        • C cbens
          29 Apr 2025, 10:51

          Same with Fedora 42, Gnome 48

          J Offline
          J Offline
          JonB
          wrote on 29 Apr 2025, 10:57 last edited by
          #4

          @cbens
          Because there are so many issues with window positioning under Wayland, did you try switching to xcb to see whether it works there?

          1 Reply Last reply
          0
          • C Offline
            C Offline
            cbens
            wrote on 1 May 2025, 13:57 last edited by
            #5

            You're right, thanks. Running with paramter "-platform xcb" works. (Then, of course, it is no longer Wayland)

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved