summaryrefslogtreecommitdiffstats
path: root/examples/qml/blackjack/blackjack.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qml/blackjack/blackjack.qml')
-rw-r--r--examples/qml/blackjack/blackjack.qml95
1 files changed, 95 insertions, 0 deletions
diff --git a/examples/qml/blackjack/blackjack.qml b/examples/qml/blackjack/blackjack.qml
new file mode 100644
index 0000000..976661a
--- /dev/null
+++ b/examples/qml/blackjack/blackjack.qml
@@ -0,0 +1,95 @@
+import Qt 4.6
+import Scxml 1.0
+
+Rectangle {
+ color: "white"
+ width: 400
+ height: 300
+ Scxml {
+ id: controller
+ source: "blackjack.scxml"
+ }
+
+ Text {
+ id: welcomeText
+ text: "Blackjack"
+ font.pixelSize: 24
+ states: [
+ State {
+ name: "placeBets"
+ when: controller.current.waitForBet
+ PropertyChanges {
+ target: welcomeText
+ text: "Please place your bet"
+ }
+ },
+ State {
+ name: "game"
+ when: controller.current.game
+ PropertyChanges {
+ target: welcomeText
+ text: "Welcome"
+ }
+ }
+ ]
+ }
+ Rectangle {
+ color: "white"
+ x: 100
+ y: 100
+ Text {
+ color: "blue"
+ text: "You have " + controller.data.points + " points"
+ }
+ }
+ Rectangle {
+ color: "white"
+ id: betEditBg
+ x: 80
+ y: 400
+ width: 100
+ height: 20
+ TextInput {
+ id: betEdit
+ color: "black"
+ anchors.fill: parent
+ text: controller.data.pointsToBet
+ }
+ states: [
+ State {
+ name: "placeBets"
+ when: controller.current.waitForBet
+ PropertyChanges {
+ target: betEditBg
+ color: "#ffcc33"
+ opacity: 1
+ }
+ },
+ State {
+ name: "default"
+ when: !controller.current.waitForBet
+ PropertyChanges {
+ target: betEditBg
+ opacity: 0
+ }
+ }
+ ]
+ }
+ Rectangle {
+ anchors.left: betEditBg.right
+ anchors.top: betEditBg.top
+ anchors.bottom: betEditBg.bottom
+ width: 100
+ color: "blue"
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: { controller.events.bet.raise(); }
+ }
+ Text {
+ color: "yellow"
+ text: "Bet"
+ }
+ }
+
+
+}