onPositionChanged: {
if (isLeftPressed) {
console.log("aaaaaaaaaaaaaaaaaaaaaaaaaaa:", mouse.x, ":", mouse.y
, rootWindow.x, ":", rootWindow.y, ":", mapToGlobal(mouseX,mouseY))
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
if (mapToGlobal(mouseX,mouseY).x < 0 || mapToGlobal(mouseX,mouseY).y < 0) {
return;
}
}
可以再MouseArea里面使用mapToGlobal进行坐标映射
获取鼠标光标位置
可以使用MouseArea的mouseX,mouseY
mouseX : real
mouseY : real
These properties hold the coordinates of the mouse cursor.