❝Qml设置了某个控件拖拽功能,则不能使用锚点。❞
Rectangle {
id: root
width: 640;
height: 320
/* 拖拽rect */
Rectangle {
id: rect
width: 100
height: 100
anchors.left: parent.left // 由于设置了拖拽,所以这里不能使用锚
anchors.top: parent.top // 由于设置了拖拽,所以这里不能使用锚
color: "red"
MouseArea {
anchors.fill: parent
drag.target: rect
drag.axis: Drag.XAndYAxis
drag.minimumX: 0
drag.maximumX: 1080
drag.minimumY: 0
drag.maximumY: 1920
}
}
}