-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path9_mouse_area.qml
50 lines (41 loc) · 1.03 KB
/
9_mouse_area.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
Rectangle {
width: 400; height: 300;
color: "lightblue"
Text {
anchors.horizontalCenter: parent.horizontalCenter
y: 40
height: parent.height / 2
text: "Press me"
font.pixelSize: 48
MouseArea {
anchors.fill: parent
onPressed: () => parent.color = "green"
onReleased: () => parent.color = "black"
}
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
y: parent.height / 2 + 40
height: parent.height / 2
text: "Click me"
font.pixelSize: 48
MouseArea {
anchors.fill: parent
onClicked: () => parent.font.bold = !parent.font.bold
}
}
}
// next
Rectangle {
width: 400; height: 200;
color: "lightblue"
Text {
anchors.centerIn: parent
text: "Press me"; font.pixelSize: 48
color: mouseArea.pressed ? "green" : "black"
MouseArea {
id: mouseArea
anchors.fill: parent
}
}
}