aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorDamian Jansen <damian.jansen@nokia.com>2011-08-26 15:38:56 +1000
committerQt by Nokia <qt-info@nokia.com>2011-09-02 07:56:38 +0200
commit44dabd02d63ecdb776b6a102888af06cac5987c0 (patch)
tree0088cde4de22dafc5a53f009cba780abeb1ee6d4 /examples
parent04f75faee3f7aedd10748a00d83ff87a97c223e6 (diff)
Update more examples to QtQuick 2.0
Minehunt and abstractitemmodel examples use QSGview Snake now using Particles 2.0 Minor examples and twitter have updated imports Removed duplicate delegate example Change-Id: I04f8f8aeb8ef34ab2a8678ccc1d6d594b9db166e Reviewed-on: http://codereview.qt.nokia.com/3630 Reviewed-by: Bea Lam <bea.lam@nokia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/minehunt/MinehuntCore/Explosion.qml33
-rw-r--r--examples/declarative/minehunt/MinehuntCore/Tile.qml2
-rw-r--r--examples/declarative/minehunt/MinehuntCore/qmldir4
-rw-r--r--examples/declarative/minehunt/main.cpp21
-rw-r--r--examples/declarative/minehunt/minehunt.pro17
-rw-r--r--examples/declarative/minehunt/minehunt.qml4
-rw-r--r--examples/declarative/modelviews/Delegate/Delegate.qml88
-rw-r--r--examples/declarative/modelviews/Delegate/view.qml76
-rw-r--r--examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro12
-rw-r--r--examples/declarative/modelviews/abstractitemmodel/main.cpp10
-rw-r--r--examples/declarative/modelviews/abstractitemmodel/view.qml3
-rw-r--r--examples/declarative/modelviews/objectlistmodel/objectlistmodel.pro5
-rw-r--r--examples/declarative/particles/modelparticles/content/RssModel.qml2
-rw-r--r--examples/declarative/particles/trails/content/PetsModel.qml2
-rw-r--r--examples/declarative/righttoleft/layoutdirection/layoutdirection.qml2
-rw-r--r--examples/declarative/righttoleft/layoutmirroring/layoutmirroring.qml2
-rw-r--r--examples/declarative/righttoleft/textalignment/textalignment.qml2
-rw-r--r--examples/declarative/snake/content/Button.qml2
-rw-r--r--examples/declarative/snake/content/Cookie.qml24
-rw-r--r--examples/declarative/snake/content/HighScoreModel.qml2
-rw-r--r--examples/declarative/snake/content/Link.qml29
-rw-r--r--examples/declarative/snake/content/Skull.qml2
-rw-r--r--examples/declarative/snake/content/snake.js4
-rw-r--r--examples/declarative/snake/snake.qml4
-rw-r--r--examples/declarative/twitter/TwitterCore/Button.qml2
-rw-r--r--examples/declarative/twitter/TwitterCore/FatDelegate.qml2
-rw-r--r--examples/declarative/twitter/TwitterCore/Input.qml2
-rw-r--r--examples/declarative/twitter/TwitterCore/Loading.qml2
-rw-r--r--examples/declarative/twitter/TwitterCore/MultiTitleBar.qml2
-rw-r--r--examples/declarative/twitter/TwitterCore/RssModel.qml2
-rw-r--r--examples/declarative/twitter/TwitterCore/SearchView.qml2
-rw-r--r--examples/declarative/twitter/TwitterCore/TitleBar.qml2
-rw-r--r--examples/declarative/twitter/TwitterCore/ToolBar.qml2
-rw-r--r--examples/declarative/twitter/TwitterCore/UserModel.qml2
-rw-r--r--examples/declarative/twitter/TwitterCore/qmldir20
-rw-r--r--examples/declarative/twitter/twitter.qml4
36 files changed, 111 insertions, 285 deletions
diff --git a/examples/declarative/minehunt/MinehuntCore/Explosion.qml b/examples/declarative/minehunt/MinehuntCore/Explosion.qml
index a5f3f1bc31..225c19d8a3 100644
--- a/examples/declarative/minehunt/MinehuntCore/Explosion.qml
+++ b/examples/declarative/minehunt/MinehuntCore/Explosion.qml
@@ -39,28 +39,31 @@
**
****************************************************************************/
-import QtQuick 1.0
-import Qt.labs.particles 1.0
+import QtQuick 2.0
+import QtQuick.Particles 2.0
Item {
property bool explode : false
-
- Particles {
- id: particles
+ ParticleSystem {
width: 40
height: 40
- lifeSpan: 1000
- lifeSpanDeviation: 0
- source: "pics/star.png"
- count: 0
- angle: 270
- angleDeviation: 360
- velocity: 100
- velocityDeviation: 20
- z: 100
+ ImageParticle {
+ particles: ["star"]
+ source: "file:MinehuntCore/pics/star.png" // TODO: Use qrc path once QTBUG-21129 is fixed
+ }
+ Emitter {
+ id: particles
+ emitting: false
+ anchors.centerIn: parent
+ particle: "star"
+ speed: AngledDirection { angleVariation: 360; magnitude: 150; magnitudeVariation: 50 }
+ emitRate: 200
+ z: 100
+ lifeSpan: 1000
+ }
}
states: State { name: "exploding"; when: explode
- StateChangeScript {script: particles.burst(200); }
+ StateChangeScript { script: particles.burst(200); }
}
}
diff --git a/examples/declarative/minehunt/MinehuntCore/Tile.qml b/examples/declarative/minehunt/MinehuntCore/Tile.qml
index 90247f8575..9daa669425 100644
--- a/examples/declarative/minehunt/MinehuntCore/Tile.qml
+++ b/examples/declarative/minehunt/MinehuntCore/Tile.qml
@@ -39,7 +39,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Flipable {
id: flipable
diff --git a/examples/declarative/minehunt/MinehuntCore/qmldir b/examples/declarative/minehunt/MinehuntCore/qmldir
index 81980e09a6..a0213a19c4 100644
--- a/examples/declarative/minehunt/MinehuntCore/qmldir
+++ b/examples/declarative/minehunt/MinehuntCore/qmldir
@@ -1,2 +1,2 @@
-Explosion 1.0 Explosion.qml
-Tile 1.0 Tile.qml
+Explosion 2.0 Explosion.qml
+Tile 2.0 Tile.qml
diff --git a/examples/declarative/minehunt/main.cpp b/examples/declarative/minehunt/main.cpp
index 93b9a5280b..1f77efe543 100644
--- a/examples/declarative/minehunt/main.cpp
+++ b/examples/declarative/minehunt/main.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
#include <QtGui/QApplication>
-#include <QtQuick1/QDeclarativeView>
+#include <qsgview.h>
#include <QtDeclarative/QDeclarativeContext>
#include <QtDeclarative/QDeclarativeEngine>
@@ -49,23 +49,16 @@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- QDeclarativeView canvas;
-
+ QSGView canvas;
+
qmlRegisterType<TileData>();
MinehuntGame* game = new MinehuntGame();
-
-#ifdef Q_OS_SYMBIAN
- canvas.setResizeMode(QDeclarativeView::SizeRootObjectToView);
-#endif
- canvas.engine()->rootContext()->setContextObject(game);
+
+ canvas.setResizeMode(QSGView::SizeRootObjectToView);
+ canvas.engine()->rootContext()->setContextObject(game);
canvas.setSource(QString("qrc:minehunt.qml"));
QObject::connect(canvas.engine(), SIGNAL(quit()), &app, SLOT(quit()));
-
-#ifdef Q_OS_SYMBIAN
- canvas.showFullScreen();
-#else
- canvas.setGeometry(QRect(100, 100, 450, 450));
+
canvas.show();
-#endif
return app.exec();
}
diff --git a/examples/declarative/minehunt/minehunt.pro b/examples/declarative/minehunt/minehunt.pro
index fe464fb498..cf928ce333 100644
--- a/examples/declarative/minehunt/minehunt.pro
+++ b/examples/declarative/minehunt/minehunt.pro
@@ -1,23 +1,8 @@
TEMPLATE = app
TARGET = minehunt
-QT += declarative qtquick1
+QT += declarative
# Input
HEADERS += minehunt.h
SOURCES += main.cpp minehunt.cpp
RESOURCES = minehunt.qrc
-
-sources.files = minehunt.qml minehunt.pro MinehuntCore
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/declarative/minehunt
-target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/declarative/minehunt
-
-INSTALLS = sources target
-
-symbian:{
- TARGET.EPOCALLOWDLLDATA = 1
- TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
- CONFIG += qt_example
- qmlminehuntfiles.files = MinehuntCore minehunt.qml
- DEPLOYMENT += qmlminehuntfiles
-}
-
diff --git a/examples/declarative/minehunt/minehunt.qml b/examples/declarative/minehunt/minehunt.qml
index 2129350625..80aaeab185 100644
--- a/examples/declarative/minehunt/minehunt.qml
+++ b/examples/declarative/minehunt/minehunt.qml
@@ -39,8 +39,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import "MinehuntCore" 1.0
+import QtQuick 2.0
+import "MinehuntCore" 2.0
Item {
id: field
diff --git a/examples/declarative/modelviews/Delegate/Delegate.qml b/examples/declarative/modelviews/Delegate/Delegate.qml
deleted file mode 100644
index ef575f567f..0000000000
--- a/examples/declarative/modelviews/Delegate/Delegate.qml
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-//![0]
-Package {
- Text { id: listDelegate; width: 200; height: 25; text: 'Empty'; Package.name: 'list' }
- Text { id: gridDelegate; width: 100; height: 50; text: 'Empty'; Package.name: 'grid' }
-
- Rectangle {
- id: wrapper
- width: 200; height: 25
- color: 'lightsteelblue'
-
- Text { text: display; anchors.centerIn: parent }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (wrapper.state == 'inList')
- wrapper.state = 'inGrid';
- else
- wrapper.state = 'inList';
- }
- }
-
- state: 'inList'
- states: [
- State {
- name: 'inList'
- ParentChange { target: wrapper; parent: listDelegate }
- },
- State {
- name: 'inGrid'
- ParentChange {
- target: wrapper; parent: gridDelegate
- x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height
- }
- }
- ]
-
- transitions: [
- Transition {
- ParentAnimation {
- NumberAnimation { properties: 'x,y,width,height'; duration: 300 }
- }
- }
- ]
- }
-}
-//![0]
diff --git a/examples/declarative/modelviews/Delegate/view.qml b/examples/declarative/modelviews/Delegate/view.qml
deleted file mode 100644
index 89fed86aa6..0000000000
--- a/examples/declarative/modelviews/Delegate/view.qml
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Rectangle {
- color: "white"
- width: 400
- height: 200
-
- ListModel {
- id: myModel
- ListElement { display: "One" }
- ListElement { display: "Two" }
- ListElement { display: "Three" }
- ListElement { display: "Four" }
- ListElement { display: "Five" }
- ListElement { display: "Six" }
- ListElement { display: "Seven" }
- ListElement { display: "Eight" }
- }
- //![0]
- VisualDataModel {
- id: visualModel
- delegate: Delegate {}
- model: myModel
- }
-
- ListView {
- width: 200; height:200
- model: visualModel.parts.list
- }
- GridView {
- x: 200; width: 200; height:200
- cellHeight: 50
- model: visualModel.parts.grid
- }
- //![0]
-}
diff --git a/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro b/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro
index 760a8dca55..6c51eed9d2 100644
--- a/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro
+++ b/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro
@@ -1,8 +1,10 @@
TEMPLATE = app
-
-QT += declarative qtquick1
-
-RESOURCES += abstractitemmodel.qrc
+TARGET = abstractitemmodel
+DEPENDPATH += .
+INCLUDEPATH += .
+QT += declarative
HEADERS = model.h
-SOURCES = main.cpp model.cpp
+SOURCES = main.cpp \
+ model.cpp
+RESOURCES += abstractitemmodel.qrc \ No newline at end of file
diff --git a/examples/declarative/modelviews/abstractitemmodel/main.cpp b/examples/declarative/modelviews/abstractitemmodel/main.cpp
index 7f3c574178..3c78608295 100644
--- a/examples/declarative/modelviews/abstractitemmodel/main.cpp
+++ b/examples/declarative/modelviews/abstractitemmodel/main.cpp
@@ -38,10 +38,13 @@
**
****************************************************************************/
#include "model.h"
-#include <QtQuick1/QDeclarativeView>
-#include <QtDeclarative/QDeclarativeContext>
#include <QApplication>
+#include <qdeclarativeengine.h>
+#include <qdeclarativecontext.h>
+#include <qdeclarative.h>
+#include <qsgitem.h>
+#include <qsgview.h>
//![0]
int main(int argc, char ** argv)
@@ -53,7 +56,8 @@ int main(int argc, char ** argv)
model.addAnimal(Animal("Polar bear", "Large"));
model.addAnimal(Animal("Quoll", "Small"));
- QDeclarativeView view;
+ QSGView view;
+ view.setResizeMode(QSGView::SizeRootObjectToView);
QDeclarativeContext *ctxt = view.rootContext();
ctxt->setContextProperty("myModel", &model);
//![0]
diff --git a/examples/declarative/modelviews/abstractitemmodel/view.qml b/examples/declarative/modelviews/abstractitemmodel/view.qml
index 0363e9a4eb..6a02f5e750 100644
--- a/examples/declarative/modelviews/abstractitemmodel/view.qml
+++ b/examples/declarative/modelviews/abstractitemmodel/view.qml
@@ -37,12 +37,11 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
//![0]
ListView {
width: 200; height: 250
- anchors.fill: parent
model: myModel
delegate: Text { text: "Animal: " + type + ", " + size }
diff --git a/examples/declarative/modelviews/objectlistmodel/objectlistmodel.pro b/examples/declarative/modelviews/objectlistmodel/objectlistmodel.pro
index de3e16f948..8cc293dbfa 100644
--- a/examples/declarative/modelviews/objectlistmodel/objectlistmodel.pro
+++ b/examples/declarative/modelviews/objectlistmodel/objectlistmodel.pro
@@ -10,9 +10,4 @@ SOURCES += main.cpp \
HEADERS += dataobject.h
RESOURCES += objectlistmodel.qrc
-sources.files = $$SOURCES $$HEADERS $$RESOURCES objectlistmodel.pro view.qml
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/declarative/objectlistmodel
-target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/declarative/objectlistmodel
-
-INSTALLS += sources target
diff --git a/examples/declarative/particles/modelparticles/content/RssModel.qml b/examples/declarative/particles/modelparticles/content/RssModel.qml
index 603a157de5..edb3ceac42 100644
--- a/examples/declarative/particles/modelparticles/content/RssModel.qml
+++ b/examples/declarative/particles/modelparticles/content/RssModel.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
XmlListModel {
property string tags : ""
diff --git a/examples/declarative/particles/trails/content/PetsModel.qml b/examples/declarative/particles/trails/content/PetsModel.qml
index d7375a73af..e55d274fa2 100644
--- a/examples/declarative/particles/trails/content/PetsModel.qml
+++ b/examples/declarative/particles/trails/content/PetsModel.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
ListModel {
ListElement {
diff --git a/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml b/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml
index 3044430cd7..9032c6d96b 100644
--- a/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml
+++ b/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
-import QtQuick 1.1
+import QtQuick 2.0
Rectangle {
id: root
diff --git a/examples/declarative/righttoleft/layoutmirroring/layoutmirroring.qml b/examples/declarative/righttoleft/layoutmirroring/layoutmirroring.qml
index b4065baf3e..fc4f83b76c 100644
--- a/examples/declarative/righttoleft/layoutmirroring/layoutmirroring.qml
+++ b/examples/declarative/righttoleft/layoutmirroring/layoutmirroring.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
-import QtQuick 1.1
+import QtQuick 2.0
Rectangle {
id: root
diff --git a/examples/declarative/righttoleft/textalignment/textalignment.qml b/examples/declarative/righttoleft/textalignment/textalignment.qml
index afd2d68c72..13abca1fb1 100644
--- a/examples/declarative/righttoleft/textalignment/textalignment.qml
+++ b/examples/declarative/righttoleft/textalignment/textalignment.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
-import QtQuick 1.1
+import QtQuick 2.0
Rectangle {
id: root
diff --git a/examples/declarative/snake/content/Button.qml b/examples/declarative/snake/content/Button.qml
index d8a3363d6d..e9b13b187b 100644
--- a/examples/declarative/snake/content/Button.qml
+++ b/examples/declarative/snake/content/Button.qml
@@ -39,7 +39,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Rectangle {
id: container
diff --git a/examples/declarative/snake/content/Cookie.qml b/examples/declarative/snake/content/Cookie.qml
index 29b56f9e88..e3b3bbf3f5 100644
--- a/examples/declarative/snake/content/Cookie.qml
+++ b/examples/declarative/snake/content/Cookie.qml
@@ -39,8 +39,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import Qt.labs.particles 1.0
+import QtQuick 2.0
+import QtQuick.Particles 2.0
Item {
id: root
@@ -68,13 +68,21 @@ Item {
}
- Particles { id: particles
+ ParticleSystem {
width:1; height:1; anchors.centerIn: parent;
- emissionRate: 0;
- lifeSpan: 700; lifeSpanDeviation: 600;
- angle: 0; angleDeviation: 360;
- velocity: 100; velocityDeviation:30;
- source: "pics/yellowStar.png";
+ ImageParticle {
+ particles: ["star"]
+ source: "pics/yellowStar.png"
+ }
+ Emitter {
+ id: particles
+ anchors.fill: parent
+ particle: "star"
+ emitRate: 50
+ emitting: false
+ lifeSpan: 700
+ acceleration: AngledDirection { angleVariation: 360; magnitude: 200 }
+ }
}
states: [
diff --git a/examples/declarative/snake/content/HighScoreModel.qml b/examples/declarative/snake/content/HighScoreModel.qml
index 91b2185ffc..9c520f6292 100644
--- a/examples/declarative/snake/content/HighScoreModel.qml
+++ b/examples/declarative/snake/content/HighScoreModel.qml
@@ -39,7 +39,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
// Models a high score table.
//
diff --git a/examples/declarative/snake/content/Link.qml b/examples/declarative/snake/content/Link.qml
index ff67ad749e..82e0359a1a 100644
--- a/examples/declarative/snake/content/Link.qml
+++ b/examples/declarative/snake/content/Link.qml
@@ -39,8 +39,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import Qt.labs.particles 1.0
+import QtQuick 2.0
+import QtQuick.Particles 2.0
Item { id:link
property bool dying: false
@@ -93,19 +93,20 @@ Item { id:link
opacity: 0
}
-
- Particles { id: particles
+ ParticleSystem {
width:1; height:1; anchors.centerIn: parent;
- emissionRate: 0;
- lifeSpan: 700; lifeSpanDeviation: 600;
- angle: 0; angleDeviation: 360;
- velocity: 100; velocityDeviation:30;
- source: {
- if(type == 1){
- "pics/blueStar.png";
- } else {
- "pics/redStar.png";
- }
+ ImageParticle {
+ particles: ["star"]
+ source: type == 1 ? "pics/blueStar.png" : "pics/redStar.png"
+ }
+ Emitter {
+ id: particles
+ anchors.fill: parent
+ particle: "star"
+ emitRate: 50
+ emitting: false
+ lifeSpan: 700
+ acceleration: AngledDirection { angleVariation: 360; magnitude: 200 }
}
}
diff --git a/examples/declarative/snake/content/Skull.qml b/examples/declarative/snake/content/Skull.qml
index 4f48145f84..1edd69eb46 100644
--- a/examples/declarative/snake/content/Skull.qml
+++ b/examples/declarative/snake/content/Skull.qml
@@ -39,7 +39,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Image {
property bool spawned: false
diff --git a/examples/declarative/snake/content/snake.js b/examples/declarative/snake/content/snake.js
index 837b82addd..107c9f4591 100644
--- a/examples/declarative/snake/content/snake.js
+++ b/examples/declarative/snake/content/snake.js
@@ -5,8 +5,8 @@ var links = new Array;
var scheduledDirections = new Array;
var numRows = 1;
var numColumns = 1;
-var linkComponent = Qt.createComponent("content/Link.qml"); // XXX should resolve relative to script, not component
-var cookieComponent = Qt.createComponent("content/Cookie.qml");
+var linkComponent = Qt.createComponent("Link.qml");
+var cookieComponent = Qt.createComponent("Cookie.qml");
var cookie;
var linksToGrow = 0;
var linksToDie = 0;
diff --git a/examples/declarative/snake/snake.qml b/examples/declarative/snake/snake.qml
index edccd4c9df..03657fec01 100644
--- a/examples/declarative/snake/snake.qml
+++ b/examples/declarative/snake/snake.qml
@@ -39,7 +39,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
import "content" as Content
import "content/snake.js" as Logic
@@ -76,7 +76,7 @@ Rectangle {
Timer {
id: heartbeat;
interval: heartbeatInterval;
- running: activeGame && runtime.isActiveWindow
+ running: activeGame && Qt.application.active
repeat: true
onTriggered: { Logic.move() }
}
diff --git a/examples/declarative/twitter/TwitterCore/Button.qml b/examples/declarative/twitter/TwitterCore/Button.qml
index 34ca181527..576c48576a 100644
--- a/examples/declarative/twitter/TwitterCore/Button.qml
+++ b/examples/declarative/twitter/TwitterCore/Button.qml
@@ -39,7 +39,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Item {
id: container
diff --git a/examples/declarative/twitter/TwitterCore/FatDelegate.qml b/examples/declarative/twitter/TwitterCore/FatDelegate.qml
index 1fe289159c..ce20620314 100644
--- a/examples/declarative/twitter/TwitterCore/FatDelegate.qml
+++ b/examples/declarative/twitter/TwitterCore/FatDelegate.qml
@@ -39,7 +39,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Component {
id: listDelegate
diff --git a/examples/declarative/twitter/TwitterCore/Input.qml b/examples/declarative/twitter/TwitterCore/Input.qml
index 96fafb6bd2..76b1809d6a 100644
--- a/examples/declarative/twitter/TwitterCore/Input.qml
+++ b/examples/declarative/twitter/TwitterCore/Input.qml
@@ -39,7 +39,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
FocusScope {
id:container
diff --git a/examples/declarative/twitter/TwitterCore/Loading.qml b/examples/declarative/twitter/TwitterCore/Loading.qml
index e0c4fa03eb..e15d908610 100644
--- a/examples/declarative/twitter/TwitterCore/Loading.qml
+++ b/examples/declarative/twitter/TwitterCore/Loading.qml
@@ -39,7 +39,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Image {
id: loading; source: "images/loading.png"
diff --git a/examples/declarative/twitter/TwitterCore/MultiTitleBar.qml b/examples/declarative/twitter/TwitterCore/MultiTitleBar.qml
index 6933d485c0..73a8ab2698 100644
--- a/examples/declarative/twitter/TwitterCore/MultiTitleBar.qml
+++ b/examples/declarative/twitter/TwitterCore/MultiTitleBar.qml
@@ -39,7 +39,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Item {
TitleBar { id: titleBar; width: parent.width; height: 60;
diff --git a/examples/declarative/twitter/TwitterCore/RssModel.qml b/examples/declarative/twitter/TwitterCore/RssModel.qml
index 696ae9d24d..2abbedcf69 100644
--- a/examples/declarative/twitter/TwitterCore/RssModel.qml
+++ b/examples/declarative/twitter/TwitterCore/RssModel.qml
@@ -39,7 +39,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Item { id: wrapper
property variant model: xmlModel
diff --git a/examples/declarative/twitter/TwitterCore/SearchView.qml b/examples/declarative/twitter/TwitterCore/SearchView.qml
index 6e099ae1c7..96f6c8e2cd 100644
--- a/examples/declarative/twitter/TwitterCore/SearchView.qml
+++ b/examples/declarative/twitter/TwitterCore/SearchView.qml
@@ -39,7 +39,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
FocusScope {
id: wrapper
diff --git a/examples/declarative/twitter/TwitterCore/TitleBar.qml b/examples/declarative/twitter/TwitterCore/TitleBar.qml
index 1a2f5d5855..e0ac7f26cc 100644
--- a/examples/declarative/twitter/TwitterCore/TitleBar.qml
+++ b/examples/declarative/twitter/TwitterCore/TitleBar.qml
@@ -39,7 +39,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Item {
id: titleBar
diff --git a/examples/declarative/twitter/TwitterCore/ToolBar.qml b/examples/declarative/twitter/TwitterCore/ToolBar.qml
index b277517332..9cf04ab940 100644
--- a/examples/declarative/twitter/TwitterCore/ToolBar.qml
+++ b/examples/declarative/twitter/TwitterCore/ToolBar.qml
@@ -39,7 +39,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Item {
id: toolbar
diff --git a/examples/declarative/twitter/TwitterCore/UserModel.qml b/examples/declarative/twitter/TwitterCore/UserModel.qml
index b87a083eae..00eabb912d 100644
--- a/examples/declarative/twitter/TwitterCore/UserModel.qml
+++ b/examples/declarative/twitter/TwitterCore/UserModel.qml
@@ -39,7 +39,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
//This "model" gets the user information about the searched user. Mainly for the icon.
diff --git a/examples/declarative/twitter/TwitterCore/qmldir b/examples/declarative/twitter/TwitterCore/qmldir
index 84d85c2885..452a648b23 100644
--- a/examples/declarative/twitter/TwitterCore/qmldir
+++ b/examples/declarative/twitter/TwitterCore/qmldir
@@ -1,10 +1,10 @@
-SearchView 1.0 SearchView.qml
-Button 1.0 Button.qml
-Input 1.0 Input.qml
-FatDelegate 1.0 FatDelegate.qml
-Loading 1.0 Loading.qml
-MultiTitleBar 1.0 MultiTitleBar.qml
-TitleBar 1.0 TitleBar.qml
-RssModel 1.0 RssModel.qml
-UserModel 1.0 UserModel.qml
-ToolBar 1.0 ToolBar.qml
+SearchView 2.0 SearchView.qml
+Button 2.0 Button.qml
+Input 2.0 Input.qml
+FatDelegate 2.0 FatDelegate.qml
+Loading 2.0 Loading.qml
+MultiTitleBar 2.0 MultiTitleBar.qml
+TitleBar 2.0 TitleBar.qml
+RssModel 2.0 RssModel.qml
+UserModel 2.0 UserModel.qml
+ToolBar 2.0 ToolBar.qml
diff --git a/examples/declarative/twitter/twitter.qml b/examples/declarative/twitter/twitter.qml
index 1700b5dcd1..05197e26b8 100644
--- a/examples/declarative/twitter/twitter.qml
+++ b/examples/declarative/twitter/twitter.qml
@@ -39,8 +39,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import "TwitterCore" 1.0 as Twitter
+import QtQuick 2.0
+import "TwitterCore" 2.0 as Twitter
Item {
id: screen; width: 320; height: 480