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. Issue moving .qml app between monitors using flags: Qt.Window | Qt.FramelessWindowHint. Is this a bug?
Forum Updated to NodeBB v4.3 + New Features

Issue moving .qml app between monitors using flags: Qt.Window | Qt.FramelessWindowHint. Is this a bug?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 140 Views
  • 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.
  • A Offline
    A Offline
    Amulex
    wrote on last edited by
    #1

    Hey!

    Hope this is the right place. I'm working with QDS but I believe this to be a QML/QT Quick issue. If you have any insight, please let me know!

    Environment: I am developing on a Windows 11 device. I have 3 monitors with 3 different aspect ratios and DPI.

    I have been working on a frameless window which works great until you try to move between monitors. There are three issues:

    • When moving between monitors, the window size gets smaller.

    • The screen flickers in different locations on the screen before moving over. It kind of spazzes out, not sure how to describe it.

    • Moving between monitors can cause the program to disappear requiring a force close. It's on the taskbar but not visible.

    One method to avoid this is to repaint the window at the destination instead of having the drag and drop visual. This is a bad solution.

    In my research, this appears to be an existing issue, though all posts are older.

    • https://github.com/stdware/qwindowkit/tree/main - a repo fixing this issue, though I work in python, not sure how I would implement this fix.

    This is my pseudo-workaround. It works but getting the window where you want is non-intuitive.

    import QtQuick
    import QtQuick.Window
    
    Window {
        id: window
        width: 1600
        height: 900
        minimumWidth: 1600
        maximumWidth: 1600
        minimumHeight: 900
        maximumHeight: 900
        visible: true
        flags: Qt.Window | Qt.FramelessWindowHint
        color: "#EAEAEA"
    
        MouseArea {
            anchors.fill: parent
            property point lastMousePos
            property point startWindowPos
            property bool isDragging: false
    
            onPressed: {
                isDragging = true
                lastMousePos = Qt.point(mouseX, mouseY)
                startWindowPos = Qt.point(window.x, window.y)
            }
    
            onReleased: {
                if (isDragging) {
                    var delta = Qt.point(mouseX - lastMousePos.x, mouseY - lastMousePos.y)
                    var finalX = startWindowPos.x + delta.x
                    var finalY = startWindowPos.y + delta.y
    
                    // Directly set the final position
                    window.x = finalX
                    window.y = finalY
                    isDragging = false
                }
            }
    
            onPositionChanged: {
                if (isDragging) {
                    // We could optionally show a preview or indicator of where the window will go
                    // But we don't actually move the window until release
                }
            }
        }
    
        Text {
            anchors.centerIn: parent
            text: window.width + " x " + window.height + "\n" +
                  "Screen: " + (window.screen ? window.screen.name : "none") + "\n" +
                  "Position: " + Math.round(window.x) + ", " + Math.round(window.y)
            font.pixelSize: 24
            color: "black"
            horizontalAlignment: Text.AlignHCenter
        }
    }
    
    

    Any thoughts/insight would be greatly appreciated!

    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