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. Does startSystemResize() work on MacOS?
Qt 6.11 is out! See what's new in the release blog

Does startSystemResize() work on MacOS?

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

    I'm making a multiplatform app with custom shaped main window and I need to move the native resizing edge 40px from ApplicationWindow edge. So I decided to use custom resizing mechanism. I found this example and tried it in my project but resizing doesn't work on MacOS. It works fine on Windows though. I made a simple project to test startSystemResize() and it always returns "false". Am I missing something or startSystemResize() doesn't work on MacOS?

    import QtQuick
    
    Window {
        width: 640
        height: 480
    
        visible: true
        title: qsTr("Hello World")
        flags: Qt.Window | Qt.FramelessWindowHint
    
        // DragHandler {
        //     onActiveChanged: if (active)
        //                          startSystemMove()
        // }
        MouseArea {
            id: mouseArea
            anchors.fill: parent
            hoverEnabled: true
            acceptedButtons: Qt.LeftButton
    
            property int edges: 0
            property int edgeOffest: 5
    
            function setEdges(x, y) {
                edges = 0
                if (x < edgeOffest)
                    edges |= Qt.LeftEdge
                if (x > (width - edgeOffest))
                    edges |= Qt.RightEdge
                if (y < edgeOffest)
                    edges |= Qt.TopEdge
                if (y > (height - edgeOffest))
                    edges |= Qt.BottomEdge
            }
    
            cursorShape: {
                return !containsMouse ? Qt.ArrowCursor : edges == 3
                                        || edges == 12 ? Qt.SizeFDiagCursor : edges == 5
                                                         || edges == 10 ? Qt.SizeBDiagCursor : edges & 9 ? Qt.SizeVerCursor : edges & 6 ? Qt.SizeHorCursor : Qt.ArrowCursor
            }
    
            onPositionChanged: setEdges(mouseX, mouseY)
            onPressed: {
                setEdges(mouseX, mouseY)
                if (edges && containsMouse) {
                    console.log(startSystemResize(edges))
                }
            }
        }
    }
    
    
    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