-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathButton.qml
47 lines (36 loc) · 841 Bytes
/
Button.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
import QtQuick 2.0
Rectangle {
id: button
signal clicked
property alias imgSrc: img.source
property alias text: txt.text
property alias textColor: txt.color
property alias imgWidth: img.width
property alias imgHeight: img.height
color: "#dddddd"
radius: 4
border.color: "#cccccc"
Image {
id: img
anchors.centerIn: parent
width: button.width * 3/4
height: button.height * 3/4
}
Text {
id: txt
anchors.centerIn: button
}
MouseArea {
id: mouseArea
enabled: button.enabled
anchors.fill: button
hoverEnabled: true
onClicked: button.clicked()
onPressed: {
button.opacity = 0.5
}
onReleased: {
button.opacity = 1.0
}
}
}//button