diff options
Diffstat (limited to 'demos/declarative/samegame/content/MediaButton.qml')
-rw-r--r-- | demos/declarative/samegame/content/MediaButton.qml | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/demos/declarative/samegame/content/MediaButton.qml b/demos/declarative/samegame/content/MediaButton.qml new file mode 100644 index 0000000000..49922f0651 --- /dev/null +++ b/demos/declarative/samegame/content/MediaButton.qml @@ -0,0 +1,39 @@ +Item { + id: Container + + signal clicked + + property string text + + Image { + id: Image + source: "pics/button.png" + } + Image { + id: Pressed + source: "pics/button-pressed.png" + opacity: 0 + } + MouseRegion { + id: MouseRegion + anchors.fill: Image + onClicked: { Container.clicked(); } + } + Text { + font.bold: true + color: "white" + anchors.centeredIn: Image + text: Container.text + } + width: Image.width + states: [ + State { + name: "Pressed" + when: MouseRegion.pressed == true + SetProperties { + target: Pressed + opacity: 1 + } + } + ] +} |