summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-07-10 07:00:04 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-07-10 07:00:04 (GMT)
commit89052de56c660baccaeae3ed83615a1dbd0494f5 (patch)
treea6718a096bedc6b9c86e1c780b7b6f3d89ef9c85 /demos
parent4cf3730c65b28f3e895a1a4c8f7db509e11c71c0 (diff)
parent6f6c25b61f6d83e86e93c5f82e2d699619d00d5e (diff)
downloadQt-89052de56c660baccaeae3ed83615a1dbd0494f5.zip
Qt-89052de56c660baccaeae3ed83615a1dbd0494f5.tar.gz
Qt-89052de56c660baccaeae3ed83615a1dbd0494f5.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (65 commits) Fix QTextDocument::markContentsDirty() Replace 4.6 in all .qdocconf files Resetting bindings through debugger interface Fix crash with invalid role indexes Make test pass and fix docs following removal of SpringFollow Remove autotests of depracted element SmoothedFollow doc improvements Clean up at the end of each test. Improve test reliability. Fix crash Follow -> Behavior Added some documentation to spring animation Fix spring animation Update QtDeclarative def files Fix exponential behavior of QTextCursor::removeSelectedText Optimization: change signal/slot to function call Don't show warning for attempts to load pixmaps asynchronously Remove Image::pixmap property. QML applications should use Update QmlChanges.txt Don't double delete cancelled pixmap cache requests ...
Diffstat (limited to 'demos')
-rw-r--r--demos/declarative/calculator/Core/calculator.js2
-rw-r--r--demos/declarative/calculator/calculator.qml29
-rw-r--r--demos/declarative/samegame/SamegameCore/BoomBlock.qml11
-rwxr-xr-xdemos/declarative/samegame/SamegameCore/samegame.js7
4 files changed, 32 insertions, 17 deletions
diff --git a/demos/declarative/calculator/Core/calculator.js b/demos/declarative/calculator/Core/calculator.js
index 51b3dd3..c80c42f 100644
--- a/demos/declarative/calculator/Core/calculator.js
+++ b/demos/declarative/calculator/Core/calculator.js
@@ -84,7 +84,7 @@ function doOperation(op) {
}
if (op == rotateLeft)
- main.state = 'rotated'
+ main.state = "orientation " + Orientation.Landscape
if (op == rotateRight)
main.state = ''
}
diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml
index 3d36211..63b6c55 100644
--- a/demos/declarative/calculator/calculator.qml
+++ b/demos/declarative/calculator/calculator.qml
@@ -58,10 +58,11 @@ Rectangle {
property string plusminus : "\u00b1"
function doOp(operation) { CalcEngine.doOperation(operation) }
-
+
Item {
id: main
- state: (runtime.orientation == Orientation.Portrait) ? '' : 'rotated'
+ state: "orientation " + runtime.orientation
+
width: parent.width; height: parent.height; anchors.centerIn: parent
Column {
@@ -130,16 +131,28 @@ Rectangle {
}
}
- states: State {
- name: 'rotated'
- PropertyChanges { target: main; rotation: -90; width: window.height; height: window.width }
- PropertyChanges { target: rotateButton; operation: rotateRight }
- }
+ states: [
+ State {
+ name: "orientation " + Orientation.Landscape
+ PropertyChanges { target: main; rotation: -90; width: window.height; height: window.width }
+ PropertyChanges { target: rotateButton; operation: rotateRight }
+ },
+ State {
+ name: "orientation " + Orientation.PortraitInverted
+ PropertyChanges { target: main; rotation: -180; }
+ PropertyChanges { target: rotateButton; operation: rotateLeft }
+ },
+ State {
+ name: "orientation " + Orientation.LandscapeInverted
+ PropertyChanges { target: main; rotation: -270; width: window.height; height: window.width }
+ PropertyChanges { target: rotateButton; operation: rotateRight }
+ }
+ ]
transitions: Transition {
SequentialAnimation {
PropertyAction { target: rotateButton; property: "operation" }
- NumberAnimation { properties: "rotation"; duration: 300; easing.type: Easing.InOutQuint }
+ RotationAnimation { direction: RotationAnimation.Shortest; duration: 300; easing.type: Easing.InOutQuint }
NumberAnimation { properties: "x,y,width,height"; duration: 300; easing.type: Easing.InOutQuint }
}
}
diff --git a/demos/declarative/samegame/SamegameCore/BoomBlock.qml b/demos/declarative/samegame/SamegameCore/BoomBlock.qml
index 3f43579..43050af 100644
--- a/demos/declarative/samegame/SamegameCore/BoomBlock.qml
+++ b/demos/declarative/samegame/SamegameCore/BoomBlock.qml
@@ -47,11 +47,14 @@ Item {
property bool dying: false
property bool spawned: false
property int type: 0
- property int targetX: 0
- property int targetY: 0
- SpringFollow on x { enabled: spawned; to: targetX; spring: 2; damping: 0.2 }
- SpringFollow on y { to: targetY; spring: 2; damping: 0.2 }
+ Behavior on x {
+ enabled: spawned;
+ SpringAnimation{ spring: 2; damping: 0.2 }
+ }
+ Behavior on y {
+ SpringAnimation{ spring: 2; damping: 0.2 }
+ }
Image {
id: img
diff --git a/demos/declarative/samegame/SamegameCore/samegame.js b/demos/declarative/samegame/SamegameCore/samegame.js
index 5c008a2..6e1b24d 100755
--- a/demos/declarative/samegame/SamegameCore/samegame.js
+++ b/demos/declarative/samegame/SamegameCore/samegame.js
@@ -110,7 +110,7 @@ function shuffleDown()
}else{
if(fallDist > 0){
var obj = board[index(column,row)];
- obj.targetY += fallDist * gameCanvas.blockSize;
+ obj.y += fallDist * gameCanvas.blockSize;
board[index(column,row+fallDist)] = obj;
board[index(column,row)] = null;
}
@@ -128,7 +128,7 @@ function shuffleDown()
obj = board[index(column,row)];
if(obj == null)
continue;
- obj.targetX -= fallDist * gameCanvas.blockSize;
+ obj.x -= fallDist * gameCanvas.blockSize;
board[index(column-fallDist,row)] = obj;
board[index(column,row)] = null;
}
@@ -184,8 +184,7 @@ function createBlock(column,row){
}
dynamicObject.type = Math.floor(Math.random() * 3);
dynamicObject.x = column*gameCanvas.blockSize;
- dynamicObject.targetX = column*gameCanvas.blockSize;
- dynamicObject.targetY = row*gameCanvas.blockSize;
+ dynamicObject.y = row*gameCanvas.blockSize;
dynamicObject.width = gameCanvas.blockSize;
dynamicObject.height = gameCanvas.blockSize;
dynamicObject.spawned = true;