From 44dabd02d63ecdb776b6a102888af06cac5987c0 Mon Sep 17 00:00:00 2001 From: Damian Jansen Date: Fri, 26 Aug 2011 15:38:56 +1000 Subject: [PATCH] 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 --- .../minehunt/MinehuntCore/Explosion.qml | 33 ++++---- .../declarative/minehunt/MinehuntCore/Tile.qml | 2 +- examples/declarative/minehunt/MinehuntCore/qmldir | 4 +- examples/declarative/minehunt/main.cpp | 21 ++---- examples/declarative/minehunt/minehunt.pro | 17 +---- examples/declarative/minehunt/minehunt.qml | 4 +- .../declarative/modelviews/Delegate/Delegate.qml | 88 ---------------------- examples/declarative/modelviews/Delegate/view.qml | 76 ------------------- .../abstractitemmodel/abstractitemmodel.pro | 12 +-- .../modelviews/abstractitemmodel/main.cpp | 10 ++- .../modelviews/abstractitemmodel/view.qml | 3 +- .../modelviews/objectlistmodel/objectlistmodel.pro | 5 -- .../particles/modelparticles/content/RssModel.qml | 2 +- .../particles/trails/content/PetsModel.qml | 2 +- .../layoutdirection/layoutdirection.qml | 2 +- .../layoutmirroring/layoutmirroring.qml | 2 +- .../righttoleft/textalignment/textalignment.qml | 2 +- examples/declarative/snake/content/Button.qml | 2 +- examples/declarative/snake/content/Cookie.qml | 24 ++++-- .../declarative/snake/content/HighScoreModel.qml | 2 +- examples/declarative/snake/content/Link.qml | 29 +++---- examples/declarative/snake/content/Skull.qml | 2 +- examples/declarative/snake/content/snake.js | 4 +- examples/declarative/snake/snake.qml | 4 +- .../declarative/twitter/TwitterCore/Button.qml | 2 +- .../twitter/TwitterCore/FatDelegate.qml | 2 +- examples/declarative/twitter/TwitterCore/Input.qml | 2 +- .../declarative/twitter/TwitterCore/Loading.qml | 2 +- .../twitter/TwitterCore/MultiTitleBar.qml | 2 +- .../declarative/twitter/TwitterCore/RssModel.qml | 2 +- .../declarative/twitter/TwitterCore/SearchView.qml | 2 +- .../declarative/twitter/TwitterCore/TitleBar.qml | 2 +- .../declarative/twitter/TwitterCore/ToolBar.qml | 2 +- .../declarative/twitter/TwitterCore/UserModel.qml | 2 +- examples/declarative/twitter/TwitterCore/qmldir | 20 ++--- examples/declarative/twitter/twitter.qml | 4 +- 36 files changed, 111 insertions(+), 285 deletions(-) delete mode 100644 examples/declarative/modelviews/Delegate/Delegate.qml delete mode 100644 examples/declarative/modelviews/Delegate/view.qml diff --git a/examples/declarative/minehunt/MinehuntCore/Explosion.qml b/examples/declarative/minehunt/MinehuntCore/Explosion.qml index a5f3f1b..225c19d 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 90247f8..9daa669 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 81980e0..a0213a1 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 93b9a52..1f77efe 100644 --- a/examples/declarative/minehunt/main.cpp +++ b/examples/declarative/minehunt/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include +#include #include #include @@ -49,23 +49,16 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - QDeclarativeView canvas; - + QSGView canvas; + qmlRegisterType(); 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 fe464fb..cf928ce 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 2129350..80aaeab 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 ef575f5..0000000 --- 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 89fed86..0000000 --- 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 760a8dc..6c51eed 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 7f3c574..3c78608 100644 --- a/examples/declarative/modelviews/abstractitemmodel/main.cpp +++ b/examples/declarative/modelviews/abstractitemmodel/main.cpp @@ -38,10 +38,13 @@ ** ****************************************************************************/ #include "model.h" -#include -#include #include +#include +#include +#include +#include +#include //![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 0363e9a..6a02f5e 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 de3e16f..8cc293d 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 603a157..edb3cea 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 d7375a7..e55d274 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 3044430..9032c6d 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 b4065ba..fc4f83b 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 afd2d68..13abca1 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 d8a3363..e9b13b1 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 29b56f9..e3b3bbf 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 91b2185..9c520f6 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 ff67ad7..82e0359 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 4f48145..1edd69e 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 837b82a..107c9f4 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 edccd4c..03657fe 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 34ca181..576c485 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 1fe2891..ce20620 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 96fafb6..76b1809 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 e0c4fa0..e15d908 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 6933d48..73a8ab2 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 696ae9d..2abbedc 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 6e099ae..96f6c8e 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 1a2f5d5..e0ac7f2 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 b277517..9cf04ab 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 b87a083..00eabb9 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 84d85c2..452a648 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 1700b5d..05197e2 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 -- 2.7.4