diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2012-07-05 11:45:28 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-12 06:33:12 +0200 |
commit | 942b5fa9cc3924d5f022091c015ab0717bc79512 (patch) | |
tree | e66bb88d43be433a7a93649f9b43f7427a10d41c /examples/demos/samegame/content/Button.qml | |
parent | 3aaaf52af2f980fa0026adc0a891df4ac86d2010 (diff) |
Add new samegame and calculator demos
Change-Id: I06ac38a1d0f844eba367fc5e163151d1f70a0012
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Diffstat (limited to 'examples/demos/samegame/content/Button.qml')
-rw-r--r-- | examples/demos/samegame/content/Button.qml | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/examples/demos/samegame/content/Button.qml b/examples/demos/samegame/content/Button.qml index 7fdb1fc75e..e8a67a540c 100644 --- a/examples/demos/samegame/content/Button.qml +++ b/examples/demos/samegame/content/Button.qml @@ -39,37 +39,29 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQuick.Particles 2.0 -Rectangle { - id: container - - property string text: "Button" - property int fontSize: 24 - +Item { + property alias imgSrc: image.source + property alias system: emitter.system + property alias group: emitter.group signal clicked - - width: buttonLabel.width + 20; height: buttonLabel.height + 20 - smooth: true - border { width: 1; color: Qt.darker(activePalette.button) } - radius: 8 - color: activePalette.button - - gradient: Gradient { - GradientStop { - position: 0.0 - color: { - if (mouseArea.pressed) - return activePalette.dark - else - return activePalette.light - } + property bool rotatedButton: false + //Defaults, feel free to override + width: image.width + height: image.height + Image { + id: image + anchors.centerIn: parent + rotation: rotatedButton ? ((Math.random() * 3 + 2) * (Math.random() <= 0.5 ? -1 : 1)) : 0 + MenuEmitter { + id: emitter + anchors.fill: parent + //shape: MaskShape {source: image.source} } - GradientStop { position: 1.0; color: activePalette.button } } - - MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() } - - Text { - id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText; font.pixelSize: container.fontSize + MouseArea { + anchors.fill: parent + onClicked: {parent.clicked(); emitter.burst(400);} } } |