blob: 83f61d767aa683815d8a9fdb2167fc606c5c0a29 (
plain)
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
|
import QtQuick 2.0
Rectangle {
id: backgroundRect
width: 150
height: 30
radius: 0
property alias image: img.source
property alias text: text.text
property alias color: backgroundRect.color
signal clicked
color: "red"
z: 2
Image {
id: img
width: height
anchors.top: parent.top
anchors.topMargin: 2
anchors.bottom: parent.bottom
anchors.bottomMargin: 2
anchors.left: parent.left
anchors.leftMargin: 5
smooth: true
source: "qrc:/qtquickplugin/images/template_image.png"
}
MouseArea {
id: mouseArea
anchors.fill: parent
onClicked: parent.clicked()
}
Text {
id: text
text: "Button text"
font.bold: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: img.right
anchors.leftMargin: 5
anchors.top: parent.top
anchors.topMargin: 0
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
color: "white"
font.pixelSize: 12
}
states: State {
name: "pressed"; when: mouseArea.pressed
PropertyChanges { target: backgroundRect; color: Qt.darker(color) }
}
}
|