Rectangle{
id:test
color:"#065076"
anchors.fill: parent
border.width: 2
border.color: "#0E8CCD"
MouseArea { //为窗口添加鼠标事件
height: parent.height
width: parent.width-60
acceptedButtons: Qt.LeftButton //只处理鼠标左键
property point clickPos: "0,0"
onPressed: {
clickPos = Qt.point(mouse.x,mouse.y)
}
onPositionChanged: {
var delta = Qt.point(mouse.x-clickPos.x, mouse.y-clickPos.y)
test.x=(test.x+delta.x)
test.y=(test.y+delta.y)
}
onClicked: {
console.log(_title)
}
}
}