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