qml Drag的使用

简介: qml Drag的使用
import QtQuick
import QtQuick.Window

Window {
    id:box
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello World")

    Rectangle {
        id: blueSquare
        width: 120; height: 120
        x: box.width - width - 10;
        y: 10
        color: "blue"

        Text { text: "Drag"; font.pixelSize: 16; color: "white"; anchors.centerIn: parent }

        MouseArea {
            anchors.fill: parent
            //! [drag]
            drag.target: blueSquare
            drag.axis: Drag.XAndYAxis
            drag.minimumX: 0
            drag.maximumX: box.width - parent.width
            drag.minimumY: 0
            drag.maximumY: box.height - parent.width
            //! [drag]
        }
    }
}
目录
相关文章
|
4月前
|
API 索引 容器
qml之布局管理器(Qt Quick Layouts)
qml之布局管理器(Qt Quick Layouts)
157 2
|
3月前
Qt鼠标事件
Qt鼠标事件
|
3月前
Qml:鼠标事件
Qml:鼠标事件
|
3月前
Qml:键盘事件
Qml:键盘事件
|
自然语言处理
Qt-QML-Slider-滑块-Style
感觉滑块这个东西,可以算是一个基本模块了,在我的项目中也有这个模块,今天我将学一下一下滑块的使用以及美化工作。
372 0
Qt-QML-Slider-滑块-Style
Qt-QML-给我的导航条写一个动画-State-Transition
上篇中,我已经写出一个导航条的,虽然太丑了,不过功能是有了,这次我将要给我的导航条加一个动画,先看下演示效果
157 0
Qt-QML-给我的导航条写一个动画-State-Transition
Qt-QML-隐藏鼠标指针
后面有一段时间需要到甲方爸爸那里去写个程序去,涉及大量界面界面的活,所以呢,得重新学习学习了, 在传统的Widget中,隐藏鼠标是很简单的,只需要一句话就可以了。如下
380 0
Qt-QML-隐藏鼠标指针
Qt-QML-Slider-滑块-Style-后继
首先了,先把我上篇文章的demo准备好,不过我上次写的被我删除了,这次就重新写了一个,上代码
333 0
Qt-QML-Slider-滑块-Style-后继