How to create a resizable frameless window?
Solved
QML and Qt Quick
-
I'm trying to create a resizable frameless window. In
onPositionChanged
of aMouseArea
that fills entireWindow
, here is part of my codeif (resizable && cursorShape !== Qt.ArrowCursor) { // resize var leftTop = Qt.point(control.x, control.y) var rightBottom = Qt.point(control.x + width, control.y + height) var globalMouse = mapToGlobal(Qt.point(mouseX, mouseY)) if (edgeFlag & ShadowWindow.Edge.Left) leftTop.x = globalMouse.x // TODO... control.x = leftTop.x control.width = rightBottom.x - leftTop.x }
Currently, I just have written the code for resizing when mouse presses on left edge of my
Window
. AndedgeFlag
here represents the position of mouse. Now, there are two problems.- Resizing only works when I move the mouse press on the left edge to the right, i.e. shrink the window.
- Window shakes violently when resizing.
Can anyone help me?
-
@Kamichanw you can do it simply with
QWindow::startSystemResize
(and its friend startSystemMove) -