-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlusButton.qml
More file actions
66 lines (59 loc) · 1.48 KB
/
PlusButton.qml
File metadata and controls
66 lines (59 loc) · 1.48 KB
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
import QtQuick 2.15
Item {
id: root
property alias col: button1._btnColor
property alias radius: button1.radius
signal clicked
width: 50
height: 50
Rectangle {
property color _btnColor: "red"
id: button1
anchors.fill: parent
color: _btnColor
state: "normal"
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: {
button1.state = "hovering"
}
onExited: {
button1.state = "normal"
}
}
Text {
anchors.centerIn: parent
text: "+"
font.family: "Times New Roman"
font.pixelSize: button1.width*0.65
font.bold: true
color: "white"
}
states: [
State {
name: "normal"
PropertyChanges { target: button1; color: _btnColor}
},
State {
name: "hovering"
PropertyChanges { target: button1; color: Qt.lighter(_btnColor)}
}
]
transitions: [
Transition {
reversible: true
from: "normal"
to: "hovering"
ColorAnimation{
duration: 150
}
}
]
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: root.clicked()
}
}