blob: 186512b223245193b70c6f3a7e0cfc7151d6baae (
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
|
import Qt 4.6
Rectangle {
id: page
border.color: "black"
color: "steelblue"
radius: 5
width: pix.width + text.width + 13
height: pix.height + 10
property string text
property string icon
signal clicked
Image { id: pix; x: 5; y:5; source: parent.icon}
Text { id: text; text: page.text; color: "white"; x:pix.width+pix.x+3; anchors.verticalCenter: pix.verticalCenter;}
MouseRegion {
id: mr
anchors.fill: parent
onClicked: { parent.focus = true; page.clicked() }
}
states:
State {
name: "pressed"; when: mr.pressed
PropertyChanges { target:text; x: 5 }
PropertyChanges { target:pix; x:text.x+text.width + 3 }
}
transitions:
Transition{
NumberAnimation { properties:"x,left"; easing:"easeInOutQuad"; duration:200 }
}
}
|