summaryrefslogtreecommitdiffstats
path: root/demos/declarative/flickr/common/Star.qml
blob: 8cd47b461a109c2e2f1b7511a481d59700370614 (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
import Qt 4.6

Item {
    id: container
    width: 24
    height: 24

    property int rating
    property bool on
    signal clicked

    Image {
        id: starImage
        source: "pics/ghns_star.png"
        x: 6
        y: 7
        opacity: 0.4
        scale: 0.5
    }
    MouseArea {
        anchors.fill: container
        onClicked: { container.clicked() }
    }
    states: [
        State {
            name: "on"
            when: container.on == true
            PropertyChanges {
                target: starImage
                opacity: 1
                scale: 1
                x: 1
                y: 0
            }
        }
    ]
    transitions: [
        Transition {
            NumberAnimation {
                properties: "opacity,scale,x,y"
                easing: "easeOutBounce"
            }
        }
    ]
}