summaryrefslogtreecommitdiffstats
path: root/demos/declarative/snake/Button.qml
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2009-11-25 11:04:25 (GMT)
committermae <qt-info@nokia.com>2009-11-25 11:04:55 (GMT)
commit10d689d226d5d221e8c6bc34ce0e0af4ed5b73d6 (patch)
treee8bcb82a5d9abe21354f8187944ce7c71bee4566 /demos/declarative/snake/Button.qml
parent4c7df87f77c1bfda4290f729dd2ed993eadb5362 (diff)
downloadQt-10d689d226d5d221e8c6bc34ce0e0af4ed5b73d6.zip
Qt-10d689d226d5d221e8c6bc34ce0e0af4ed5b73d6.tar.gz
Qt-10d689d226d5d221e8c6bc34ce0e0af4ed5b73d6.tar.bz2
added a snake demo
Diffstat (limited to 'demos/declarative/snake/Button.qml')
-rw-r--r--demos/declarative/snake/Button.qml25
1 files changed, 25 insertions, 0 deletions
diff --git a/demos/declarative/snake/Button.qml b/demos/declarative/snake/Button.qml
new file mode 100644
index 0000000..63cd555
--- /dev/null
+++ b/demos/declarative/snake/Button.qml
@@ -0,0 +1,25 @@
+import Qt 4.6
+
+Rectangle {
+ id: container
+
+ signal clicked
+ property string text: "Button"
+
+ color: activePalette.button; smooth: true
+ width: txtItem.width + 20; height: txtItem.height + 6
+ border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8;
+
+ gradient: Gradient {
+ GradientStop {
+ id: topGrad; position: 0.0
+ color: if (mr.pressed) { activePalette.dark } else { activePalette.light } }
+ GradientStop { position: 1.0; color: activePalette.button }
+ }
+
+ MouseRegion { id: mr; anchors.fill: parent; onClicked: container.clicked() }
+
+ Text {
+ id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText
+ }
+}