summaryrefslogtreecommitdiffstats
path: root/demos/declarative/flickr/common/Star.qml
diff options
context:
space:
mode:
Diffstat (limited to 'demos/declarative/flickr/common/Star.qml')
-rw-r--r--demos/declarative/flickr/common/Star.qml45
1 files changed, 45 insertions, 0 deletions
diff --git a/demos/declarative/flickr/common/Star.qml b/demos/declarative/flickr/common/Star.qml
new file mode 100644
index 0000000..c5abcca
--- /dev/null
+++ b/demos/declarative/flickr/common/Star.qml
@@ -0,0 +1,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
+ }
+ MouseRegion {
+ 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 {
+ matchProperties: "opacity,scale,x,y"
+ easing: "easeOutBounce"
+ }
+ }
+ ]
+}