summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-04-01 02:49:35 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-04-01 05:10:50 (GMT)
commit919ee9dd93ad382ddd813d58a356fd3f8d179046 (patch)
tree08f89cc2c90f9cc85318d2e32c0b305310fe9965 /examples
parent7e94b6e0f706284088d52054ef0d1be0a13ea186 (diff)
downloadQt-919ee9dd93ad382ddd813d58a356fd3f8d179046.zip
Qt-919ee9dd93ad382ddd813d58a356fd3f8d179046.tar.gz
Qt-919ee9dd93ad382ddd813d58a356fd3f8d179046.tar.bz2
Doc improvements, fixes
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/tutorials/samegame/samegame1/Button.qml4
-rw-r--r--examples/declarative/tutorials/samegame/samegame1/samegame.qml2
-rw-r--r--examples/declarative/tutorials/samegame/samegame2/Button.qml4
-rw-r--r--examples/declarative/tutorials/samegame/samegame2/samegame.js6
-rw-r--r--examples/declarative/tutorials/samegame/samegame2/samegame.qml8
-rw-r--r--examples/declarative/tutorials/samegame/samegame3/Button.qml4
-rw-r--r--examples/declarative/tutorials/samegame/samegame3/Dialog.qml2
-rw-r--r--examples/declarative/tutorials/samegame/samegame3/samegame.js6
-rw-r--r--examples/declarative/tutorials/samegame/samegame3/samegame.qml7
-rw-r--r--examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml2
-rw-r--r--examples/declarative/tutorials/samegame/samegame4/content/Button.qml4
-rw-r--r--examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml2
-rw-r--r--examples/declarative/tutorials/samegame/samegame4/samegame.qml11
13 files changed, 31 insertions, 31 deletions
diff --git a/examples/declarative/tutorials/samegame/samegame1/Button.qml b/examples/declarative/tutorials/samegame/samegame1/Button.qml
index 2e31ff8..5e28da7 100644
--- a/examples/declarative/tutorials/samegame/samegame1/Button.qml
+++ b/examples/declarative/tutorials/samegame/samegame1/Button.qml
@@ -14,11 +14,11 @@ Rectangle {
gradient: Gradient {
GradientStop {
id: topGrad; position: 0.0
- color: if (mr.pressed) { activePalette.dark } else { activePalette.light } }
+ color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } }
GradientStop { position: 1.0; color: activePalette.button }
}
- MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() }
+ MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() }
Text {
id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText
diff --git a/examples/declarative/tutorials/samegame/samegame1/samegame.qml b/examples/declarative/tutorials/samegame/samegame1/samegame.qml
index 5ed30c9..006b926 100644
--- a/examples/declarative/tutorials/samegame/samegame1/samegame.qml
+++ b/examples/declarative/tutorials/samegame/samegame1/samegame.qml
@@ -24,7 +24,7 @@ Rectangle {
anchors.bottom: screen.bottom
Button {
- id: btnA; text: "New Game"; onClicked: console.log("Implement me!");
+ id: btnA; text: "New Game"; onClicked: console.log("Starting a new game...");
anchors.left: parent.left; anchors.leftMargin: 3
anchors.verticalCenter: parent.verticalCenter
}
diff --git a/examples/declarative/tutorials/samegame/samegame2/Button.qml b/examples/declarative/tutorials/samegame/samegame2/Button.qml
index 6629302..a7853d4 100644
--- a/examples/declarative/tutorials/samegame/samegame2/Button.qml
+++ b/examples/declarative/tutorials/samegame/samegame2/Button.qml
@@ -13,11 +13,11 @@ Rectangle {
gradient: Gradient {
GradientStop {
id: topGrad; position: 0.0
- color: if (mr.pressed) { activePalette.dark } else { activePalette.light } }
+ color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } }
GradientStop { position: 1.0; color: activePalette.button }
}
- MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() }
+ MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() }
Text {
id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText
diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.js b/examples/declarative/tutorials/samegame/samegame2/samegame.js
index 2c02c61..0ec3a8b 100644
--- a/examples/declarative/tutorials/samegame/samegame2/samegame.js
+++ b/examples/declarative/tutorials/samegame/samegame2/samegame.js
@@ -15,6 +15,12 @@ function index(xIdx,yIdx) {
function initBoard()
{
+ //Delete old blocks
+ for(var i = 0; i<maxIndex; i++){
+ if(board[i] != null)
+ board[i].destroy();
+ }
+
//Calculate board size
maxX = Math.floor(background.width/tileSize);
maxY = Math.floor(background.height/tileSize);
diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.qml b/examples/declarative/tutorials/samegame/samegame2/samegame.qml
index 7e0bc0c..89d8035 100644
--- a/examples/declarative/tutorials/samegame/samegame2/samegame.qml
+++ b/examples/declarative/tutorials/samegame/samegame2/samegame.qml
@@ -1,13 +1,13 @@
import Qt 4.6
+//![2]
+import "samegame.js" as SameGame
+//![2]
Rectangle {
id: screen
width: 490; height: 720
SystemPalette { id: activePalette }
-//![2]
- Script { source: "samegame.js" }
-//![2]
Item {
width: parent.width; anchors.top: parent.top; anchors.bottom: toolbar.top
@@ -27,7 +27,7 @@ Rectangle {
//![1]
Button {
- id: btnA; text: "New Game"; onClicked: initBoard();
+ id: btnA; text: "New Game"; onClicked: SameGame.initBoard();
anchors.left: parent.left; anchors.leftMargin: 3
anchors.verticalCenter: parent.verticalCenter
}
diff --git a/examples/declarative/tutorials/samegame/samegame3/Button.qml b/examples/declarative/tutorials/samegame/samegame3/Button.qml
index 6629302..a7853d4 100644
--- a/examples/declarative/tutorials/samegame/samegame3/Button.qml
+++ b/examples/declarative/tutorials/samegame/samegame3/Button.qml
@@ -13,11 +13,11 @@ Rectangle {
gradient: Gradient {
GradientStop {
id: topGrad; position: 0.0
- color: if (mr.pressed) { activePalette.dark } else { activePalette.light } }
+ color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } }
GradientStop { position: 1.0; color: activePalette.button }
}
- MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() }
+ MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() }
Text {
id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText
diff --git a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml
index 36178ec..966f85a 100644
--- a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml
+++ b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml
@@ -18,6 +18,6 @@ Rectangle {
NumberAnimation { duration: 1000 }
}
Text { id: myText; anchors.centerIn: parent; text: "Hello World!" }
- MouseArea { id: mr; anchors.fill: parent; onClicked: forceClose(); }
+ MouseArea { id: mouseArea; anchors.fill: parent; onClicked: forceClose(); }
}
//![0]
diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.js b/examples/declarative/tutorials/samegame/samegame3/samegame.js
index 38efb3b..33449fa 100644
--- a/examples/declarative/tutorials/samegame/samegame3/samegame.js
+++ b/examples/declarative/tutorials/samegame/samegame3/samegame.js
@@ -14,12 +14,6 @@ function index(xIdx,yIdx) {
function initBoard()
{
- for(var i = 0; i<maxIndex; i++){
- //Delete old blocks
- if(board[i] != null)
- board[i].destroy();
- }
-
//Calculate board size
maxX = Math.floor(gameCanvas.width/gameCanvas.tileSize);
maxY = Math.floor(gameCanvas.height/gameCanvas.tileSize);
diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.qml b/examples/declarative/tutorials/samegame/samegame3/samegame.qml
index 168bf9b..db25e24 100644
--- a/examples/declarative/tutorials/samegame/samegame3/samegame.qml
+++ b/examples/declarative/tutorials/samegame/samegame3/samegame.qml
@@ -1,12 +1,12 @@
//![0]
import Qt 4.6
+import "samegame.js" as SameGame
Rectangle {
id: screen
width: 490; height: 720
SystemPalette { id: activePalette }
- Script { source: "samegame.js" }
Item {
width: parent.width; anchors.top: parent.top; anchors.bottom: toolbar.top
@@ -28,8 +28,7 @@ Rectangle {
height: parent.height - (parent.height % tileSize);
MouseArea {
- id: gameMR
- anchors.fill: parent; onClicked: handleClick(mouse.x,mouse.y);
+ anchors.fill: parent; onClicked: SameGame.handleClick(mouse.x,mouse.y);
}
}
//![1]
@@ -46,7 +45,7 @@ Rectangle {
anchors.bottom: screen.bottom
Button {
- id: btnA; text: "New Game"; onClicked: initBoard();
+ id: btnA; text: "New Game"; onClicked: SameGame.initBoard();
anchors.left: parent.left; anchors.leftMargin: 3
anchors.verticalCenter: parent.verticalCenter
}
diff --git a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml
index a6ef62c..e50aae0 100644
--- a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml
+++ b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml
@@ -9,7 +9,7 @@ Item { id:block
property int targetX: 0
property int targetY: 0
- SpringFollow on x { enabled: spawned; source: targetX; spring: 2; damping: 0.2 }
+ SpringFollow on x { source: targetX; spring: 2; damping: 0.2; enabled: spawned }
SpringFollow on y { source: targetY; spring: 2; damping: 0.2 }
//![1]
diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml
index 6629302..a7853d4 100644
--- a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml
+++ b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml
@@ -13,11 +13,11 @@ Rectangle {
gradient: Gradient {
GradientStop {
id: topGrad; position: 0.0
- color: if (mr.pressed) { activePalette.dark } else { activePalette.light } }
+ color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } }
GradientStop { position: 1.0; color: activePalette.button }
}
- MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() }
+ MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() }
Text {
id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText
diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml
index 831c03b..fc83e39 100644
--- a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml
+++ b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml
@@ -17,5 +17,5 @@ Rectangle {
NumberAnimation { duration: 1000 }
}
Text { id: myText; anchors.centerIn: parent; text: "Hello World!" }
- MouseArea { id: mr; anchors.fill: parent; onClicked: forceClose(); }
+ MouseArea { id: mouseArea; anchors.fill: parent; onClicked: forceClose(); }
}
diff --git a/examples/declarative/tutorials/samegame/samegame4/samegame.qml b/examples/declarative/tutorials/samegame/samegame4/samegame.qml
index c2e8018..090496d 100644
--- a/examples/declarative/tutorials/samegame/samegame4/samegame.qml
+++ b/examples/declarative/tutorials/samegame/samegame4/samegame.qml
@@ -1,5 +1,6 @@
import Qt 4.6
import "content"
+import "content/samegame.js" as SameGame
Rectangle {
id: screen
@@ -21,20 +22,19 @@ Rectangle {
property int score: 0
property int tileSize: 40
- Script { source: "content/samegame.js" }
-
z: 20; anchors.centerIn: parent
width: parent.width - (parent.width % getTileSize());
height: parent.height - (parent.height % getTileSize());
MouseArea {
- id: gameMR
- anchors.fill: parent; onClicked: handleClick(mouse.x,mouse.y);
+ anchors.fill: parent; onClicked: SameGame.handleClick(mouse.x,mouse.y);
}
}
}
Dialog { id: dialog; anchors.centerIn: parent; z: 21 }
+
+ //![0]
Dialog {
id: scoreName; anchors.centerIn: parent; z: 22;
Text {
@@ -54,6 +54,7 @@ Rectangle {
anchors.left: spacer.right
}
}
+ //![0]
Rectangle {
id: toolBar
@@ -62,7 +63,7 @@ Rectangle {
anchors.bottom: screen.bottom
Button {
- id: btnA; text: "New Game"; onClicked: {initBoard();}
+ id: btnA; text: "New Game"; onClicked: {SameGame.initBoard();}
anchors.left: parent.left; anchors.leftMargin: 3
anchors.verticalCenter: parent.verticalCenter
}