diff options
Diffstat (limited to 'demos/declarative/flickr/common/MediaButton.qml')
-rw-r--r-- | demos/declarative/flickr/common/MediaButton.qml | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/demos/declarative/flickr/common/MediaButton.qml b/demos/declarative/flickr/common/MediaButton.qml new file mode 100644 index 0000000..c12b642 --- /dev/null +++ b/demos/declarative/flickr/common/MediaButton.qml @@ -0,0 +1,41 @@ +import Qt 4.6 + +Item { + id: container + + signal clicked + + property string text + + Image { + id: buttonImage + source: "pics/button.png" + } + Image { + id: pressed + source: "pics/button-pressed.png" + opacity: 0 + } + MouseRegion { + id: mouseRegion + anchors.fill: buttonImage + onClicked: { container.clicked(); } + } + Text { + font.bold: true + color: "white" + anchors.centerIn: buttonImage + text: container.text + } + width: buttonImage.width + states: [ + State { + name: "Pressed" + when: mouseRegion.pressed == true + PropertyChanges { + target: pressed + opacity: 1 + } + } + ] +} |