diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-03-22 05:34:41 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-03-22 05:36:35 (GMT) |
commit | 888d29c9c138ca3d698985f090ceb3db912ade0f (patch) | |
tree | aa991f683dd8e7ea4b05d029dd75b32321fde3c0 /demos/declarative/samegame/samegame.qml | |
parent | 42de973ff156383beed62a6b1bce70b56b360078 (diff) | |
download | Qt-888d29c9c138ca3d698985f090ceb3db912ade0f.zip Qt-888d29c9c138ca3d698985f090ceb3db912ade0f.tar.gz Qt-888d29c9c138ca3d698985f090ceb3db912ade0f.tar.bz2 |
Deprecate inline Script {} blocks
Inline blocks/includes have been replaced with an import syntax:
import "foo.js" as Foo
this gives better separation between QML and code. Imported script blocks
also have a mandatory qualifier, which leads to better optimization
potential.
Diffstat (limited to 'demos/declarative/samegame/samegame.qml')
-rw-r--r-- | demos/declarative/samegame/samegame.qml | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml index 3b19cbe..f084ff6 100644 --- a/demos/declarative/samegame/samegame.qml +++ b/demos/declarative/samegame/samegame.qml @@ -1,5 +1,6 @@ import Qt 4.6 import SamegameCore 1.0 +import "SamegameCore/samegame.js" as Logic Rectangle { id: screen @@ -22,15 +23,13 @@ Rectangle { property int score: 0 property int tileSize: 40 - Script { source: "SamegameCore/samegame.js" } - z: 20; anchors.centerIn: parent - width: parent.width - (parent.width % getTileSize()); - height: parent.height - (parent.height % getTileSize()); + width: parent.width - (parent.width % tileSize); + height: parent.height - (parent.height % tileSize); MouseArea { id: gameMR - anchors.fill: parent; onClicked: handleClick(mouse.x,mouse.y); + anchors.fill: parent; onClicked: Logic.handleClick(mouse.x,mouse.y); } } } @@ -57,7 +56,7 @@ Rectangle { } onAccepted: { if(scoreName.opacity==1&&editor.text!="") - saveHighScore(editor.text); + Logic.saveHighScore(editor.text); scoreName.forceClose(); } anchors.verticalCenter: parent.verticalCenter @@ -73,13 +72,13 @@ Rectangle { anchors.bottom: screen.bottom Button { - id: btnA; text: "New Game"; onClicked: {initBoard();} + id: btnA; text: "New Game"; onClicked: Logic.initBoard(); anchors.left: parent.left; anchors.leftMargin: 3 anchors.verticalCenter: parent.verticalCenter } Button { - id: btnB; text: "Quit"; onClicked: {Qt.quit();} + id: btnB; text: "Quit"; onClicked: Qt.quit(); anchors.left: btnA.right; anchors.leftMargin: 3 anchors.verticalCenter: parent.verticalCenter } |