innitial commit
[xbmc-qml-remote:xbmc-qml-remote.git] / Button.qml
1 import Qt 4.7
2
3
4 Rectangle {
5         property alias source:img.source
6         id: base
7         height: 80
8         width: 80
9         color: "transparent"
10         radius: 10
11          Behavior on color { ColorAnimation { duration: 100}}
12         Image {
13                 x: 5
14                 y: 5
15                 height: parent.height - 10
16                 width: parent.width - 10
17                 id: img
18
19                 MouseArea {
20                         anchors.fill: parent;
21                         onClicked: {
22                                 timer.start()
23                                 base.state = "pressed"
24                                 base.clicked();
25                         }
26                 }
27         }
28         states: [
29                 State {
30                         name: "normal"
31                         PropertyChanges {
32                                 target: base
33                                 color: "transparent"
34                         }
35                 },
36                 State {
37                         name: "pressed"
38                         PropertyChanges {
39                                 target: base
40                                 color: "#339"
41                         }
42                 }
43
44         ]
45         Timer {
46                 id: timer
47                 interval: 350; running: false; repeat: false
48                 onTriggered: base.state = "normal"
49
50         }
51
52 }