-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.qml
82 lines (75 loc) · 1.96 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import QtQuick 2.9
import QtQuick.Window 2.2
Window {
visible: true
width: 640
height: 480
title: qsTr("Touchscreen test")
visibility: Window.FullScreen
MouseArea {
id: mouseArea
anchors.fill: parent
onPressed: {
target.x = mouse.x
target.y = mouse.y
console.log("Released at ", mouse.x, ";", mouse.y)
}
onReleased: {
target.x = mouse.x
target.y = mouse.y
console.log("Pressed at ", mouse.x, ";", mouse.y)
}
onClicked: {
console.log("Clicked at ", mouse.x, ";", mouse.y)
}
}
Item {
id: target
property color color: mouseArea.pressed ? "red" : "blue"
Rectangle {
color: "white"
border.width: 2
border.color: parent.color
opacity: 0.3
anchors.centerIn: parent
width: 400
height: 400
radius: width/2
}
Rectangle {
color: "white"
border.width: 2
border.color: parent.color
opacity: 0.6
anchors.centerIn: parent
width: 200
height: 200
radius: width/2
}
Rectangle {
border.color: parent.color
anchors.centerIn: parent
width: 40
height: 40
radius: width/2
Rectangle {
color: target.color
height: parent.height
width: 1
anchors.centerIn: parent
}
Rectangle {
color: target.color
height: 1
width: parent.width
anchors.centerIn: parent
}
}
}
Text {
anchors.centerIn: parent
font.pixelSize: 20
text: (mouseArea.pressed ? "pressed" : "not pressed") + "\n" +
target.x + " ; " + target.y
}
}