Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to implement custom resize handlers for ApplicationWindow, correctly?



  • Hi all,

    I have an application with Qt.FramelessWindowHint flag and I want to reimplement resize for it but I'm a bit stuck because the resizing has a haotic animation.

    ResizeController.qml:

    Item {
        id: root
        property int cursorShape: Qt.SizeHorCursor
        property int xResize: 0
        property int yResize: 0
    
        MouseArea {
            id: mouseArea
            anchors.fill: parent
            acceptedButtons: Qt.LeftButton
            cursorShape: root.cursorShape
            onPositionChanged: {
                xResize = mouse.x
                yResize = mouse.y
            }
        }
    }
    

    Usage:

    ResizeController {
            anchors.bottom: parent.bottom
            anchors.right: parent.right
            width: 20
            height: width
            cursorShape: Qt.SizeFDiagCursor
            onXResizeChanged: window.width = window.width + xResize
            onYResizeChanged: window.height = window.height + yResize
        }
    

    Any ideeas what I am doing wrong?
    I'm using for building / testing: KDE Neon developer stable, 64 bit version.


Log in to reply