diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-07 06:57:21 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-07 06:57:21 (GMT) |
commit | a3a6e1622149654bc9e244e685e8e7dcbdf966b2 (patch) | |
tree | 1c4fe9feab63839213a0d97e9b24414c9585a227 /examples/declarative/tutorials/samegame/samegame4/samegame.qml | |
parent | 99573a8e81fcea38c5f68b340068fff266315c03 (diff) | |
parent | 8b0cac9179de4d1cb34b9f17932d34cef3cd4f5b (diff) | |
download | Qt-a3a6e1622149654bc9e244e685e8e7dcbdf966b2.zip Qt-a3a6e1622149654bc9e244e685e8e7dcbdf966b2.tar.gz Qt-a3a6e1622149654bc9e244e685e8e7dcbdf966b2.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into test
Conflicts:
demos/declarative/samegame/content/samegame.js
tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
Diffstat (limited to 'examples/declarative/tutorials/samegame/samegame4/samegame.qml')
-rw-r--r-- | examples/declarative/tutorials/samegame/samegame4/samegame.qml | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/examples/declarative/tutorials/samegame/samegame4/samegame.qml b/examples/declarative/tutorials/samegame/samegame4/samegame.qml new file mode 100644 index 0000000..ede4362 --- /dev/null +++ b/examples/declarative/tutorials/samegame/samegame4/samegame.qml @@ -0,0 +1,71 @@ +import Qt 4.6 +import "content" + +Rectangle { + id: Screen + width: 490; height: 720 + + Script { source: "content/samegame.js" } + + SystemPalette { id: activePalette; colorGroup: Qt.Active } + + Item { + width: parent.width; anchors.top: parent.top; anchors.bottom: ToolBar.top + + Image { + id: background + anchors.fill: parent; source: "content/pics/background.png" + fillMode: "PreserveAspectCrop" + } + + Item { + id: gameCanvas + property int score: 0 + + z: 20; anchors.centerIn: parent + width: parent.width - (parent.width % tileSize); + height: parent.height - (parent.height % tileSize); + + MouseRegion { + id: gameMR + anchors.fill: parent; onClicked: handleClick(mouse.x,mouse.y); + } + } + } + + Dialog { id: dialog; anchors.centerIn: parent; z: 21 } + Dialog { + id: scoreName; anchors.centerIn: parent; z: 22; + TextInput { + id: Editor + onAccepted: { + if(scoreName.opacity==1&&Editor.text!="") + sendHighScore(Editor.text); + scoreName.forceClose(); + } + anchors.verticalCenter: parent.verticalCenter + width: 72; focus: true + anchors.right: scoreName.right + } + } + + Rectangle { + id: ToolBar + color: activePalette.window + height: 32; width: parent.width + anchors.bottom: Screen.bottom + + Button { + id: btnA; text: "New Game"; onClicked: {initBoard();} + anchors.left: parent.left; anchors.leftMargin: 3 + anchors.verticalCenter: parent.verticalCenter + } + + Text { + id: Score + text: "Score: " + gameCanvas.score; font.bold: true + anchors.right: parent.right; anchors.rightMargin: 3 + anchors.verticalCenter: parent.verticalCenter + } + } +} |