【Qt Quick】去掉边框之后鼠标按下拖动

    MouseArea{
        anchors.fill: parent
        acceptedButtons: Qt.LeftButton//只检测鼠标左键
        property var _X: 0
        property var _Y: 0
        onPressed: {
            _X = mouseX
            _Y = mouseY
        }
        onPositionChanged: {
            main_Window.x += mouseX - _X
            main_Window.y += mouseY - _Y
        }
    }

你可能感兴趣的:(Qt,Quick,qt)