aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative/minehunt
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/declarative/minehunt
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/declarative/minehunt')
-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
6 files changed, 31 insertions, 50 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