//拖动滑块
Rectangle {
id: container
width: 600; height: 200
Rectangle {
id: rect
width: 50; height: 50
color: "red"
opacity: (600.0 - rect.x) / 600
MouseArea {
anchors.fill: parent
drag.target: rect
drag.axis: Drag.XAxis
drag.minimumX: 0
drag.maximumX: container.width - rect.width
}
}
}
QML-拖动滑块官方示例
最新推荐文章于 2024-04-27 12:10:43 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)