导入 QtQuick 2.15 导入 QtQuick.Window 2.15
窗口 { 宽度:640 高度:480 可见:true 标题:qsTr(“Hello World”)
Item {
id: _item
width: 100; height: 50;
Rectangle {
anchors.fill: parent
color: "lightblue"
}
MouseArea {
id: mouseA
anchors.fill: parent
drag.target: _item
drag.axis: Drag.YAxis
drag.minimumY: 0
drag.maximumY: _item.height
// Ensure initialY is set correctly after potential initial height of 0
property int initialY: _item.height
property int yValue: _item.y
onYValueChanged: {
console.log("Mani Y value changed to:"+ yValue +" "+initialY);
if (drag.active && initialY == yValue){
console.log("Mani Y value changed to:"+initialY);
}
}
}
}
}