summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorartoka <arto.katajasalo@digia.com>2011-11-17 14:49:49 (GMT)
committerCasper van Donderen <casper.vandonderen@nokia.com>2011-11-17 14:58:45 (GMT)
commit4e6e49bda036f493200e7d51b2ec9690025e3dfd (patch)
tree864e5b7e0794bbf7dce8f1b83f1ac6d26cccd804 /examples
parentee9307f9679953ab15d29756cd7fde930ac9080b (diff)
downloadQt-4e6e49bda036f493200e7d51b2ec9690025e3dfd.zip
Qt-4e6e49bda036f493200e7d51b2ec9690025e3dfd.tar.gz
Qt-4e6e49bda036f493200e7d51b2ec9690025e3dfd.tar.bz2
modelview/objectlistmodel example modifications
Modified example to use centralized qmlapplicationviewer, removed duplicate files and modified project files according to the changes. Merge-request: 2719 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/modelviews/objectlistmodel/main.cpp18
-rw-r--r--examples/declarative/modelviews/objectlistmodel/objectlistmodel.pro46
-rw-r--r--examples/declarative/modelviews/objectlistmodel/objectlistmodel.qmlproject6
-rw-r--r--examples/declarative/modelviews/objectlistmodel/qml/objectlistmodel/view.qml (renamed from examples/declarative/modelviews/objectlistmodel/view.qml)0
4 files changed, 44 insertions, 26 deletions
diff --git a/examples/declarative/modelviews/objectlistmodel/main.cpp b/examples/declarative/modelviews/objectlistmodel/main.cpp
index 812d8ad..826c648 100644
--- a/examples/declarative/modelviews/objectlistmodel/main.cpp
+++ b/examples/declarative/modelviews/objectlistmodel/main.cpp
@@ -38,15 +38,10 @@
**
****************************************************************************/
+#include "qmlapplicationviewer.h"
+#include "dataobject.h"
#include <QApplication>
-
-#include <qdeclarativeengine.h>
#include <qdeclarativecontext.h>
-#include <qdeclarative.h>
-#include <qdeclarativeitem.h>
-#include <qdeclarativeview.h>
-
-#include "dataobject.h"
/*
This example illustrates exposing a QList<QObject*> as a
@@ -57,6 +52,7 @@
int main(int argc, char ** argv)
{
QApplication app(argc, argv);
+ QmlApplicationViewer viewer;
QList<QObject*> dataList;
dataList.append(new DataObject("Item 1", "red"));
@@ -64,13 +60,13 @@ int main(int argc, char ** argv)
dataList.append(new DataObject("Item 3", "blue"));
dataList.append(new DataObject("Item 4", "yellow"));
- QDeclarativeView view;
- QDeclarativeContext *ctxt = view.rootContext();
+ QDeclarativeContext *ctxt = viewer.rootContext();
ctxt->setContextProperty("myModel", QVariant::fromValue(dataList));
//![0]
- view.setSource(QUrl("qrc:view.qml"));
- view.show();
+ viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
+ viewer.setMainQmlFile(QLatin1String("qml/objectlistmodel/view.qml"));
+ viewer.showExpanded();
return app.exec();
}
diff --git a/examples/declarative/modelviews/objectlistmodel/objectlistmodel.pro b/examples/declarative/modelviews/objectlistmodel/objectlistmodel.pro
index 869cde3..08ac231 100644
--- a/examples/declarative/modelviews/objectlistmodel/objectlistmodel.pro
+++ b/examples/declarative/modelviews/objectlistmodel/objectlistmodel.pro
@@ -1,18 +1,40 @@
-TEMPLATE = app
-TARGET = objectlistmodel
-DEPENDPATH += .
-INCLUDEPATH += .
-QT += declarative
+# Add more folders to ship with the application, here
+folder_01.source = qml/objectlistmodel
+folder_01.target = qml
+DEPLOYMENTFOLDERS = folder_01
-# Input
+# Additional import path used to resolve QML modules in Creator's code model
+QML_IMPORT_PATH =
+
+symbian:TARGET.UID3 = 0xE6A5F859
+
+# Smart Installer package's UID
+# This UID is from the protected range and therefore the package will
+# fail to install if self-signed. By default qmake uses the unprotected
+# range value if unprotected UID is defined for the application and
+# 0x2002CCCF value if protected UID is given to the application
+#symbian:DEPLOYMENT.installer_header = 0x2002CCCF
+
+# Allow network access on Symbian
+symbian:TARGET.CAPABILITY += NetworkServices
+
+# If your application uses the Qt Mobility libraries, uncomment the following
+# lines and add the respective components to the MOBILITY variable.
+# CONFIG += mobility
+# MOBILITY +=
+
+# Speed up launching on MeeGo/Harmattan when using applauncherd daemon
+# CONFIG += qdeclarative-boostable
+
+# Add dependency to Symbian components
+# CONFIG += qt-components
+
+# input
SOURCES += main.cpp \
dataobject.cpp
HEADERS += dataobject.h
RESOURCES += objectlistmodel.qrc
-sources.files = $$SOURCES $$HEADERS $$RESOURCES objectlistmodel.pro view.qml
-sources.path = $$[QT_INSTALL_EXAMPLES]/declarative/objectlistmodel
-target.path = $$[QT_INSTALL_EXAMPLES]/declarative/objectlistmodel
-
-INSTALLS += sources target
-
+# Please do not modify the following two lines. Required for deployment.
+include(../../../tools/qmlapplicationviewer/qmlapplicationviewer.pri)
+qtcAddDeployment()
diff --git a/examples/declarative/modelviews/objectlistmodel/objectlistmodel.qmlproject b/examples/declarative/modelviews/objectlistmodel/objectlistmodel.qmlproject
index d4909f8..a0b6c9e 100644
--- a/examples/declarative/modelviews/objectlistmodel/objectlistmodel.qmlproject
+++ b/examples/declarative/modelviews/objectlistmodel/objectlistmodel.qmlproject
@@ -3,13 +3,13 @@ import QmlProject 1.0
Project {
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
- directory: "."
+ directory: "qml/objectlistmodel"
}
JavaScriptFiles {
- directory: "."
+ directory: "qml/objectlistmodel"
}
ImageFiles {
- directory: "."
+ directory: "qml/objectlistmodel"
}
/* List of plugin directories passed to QML runtime */
// importPaths: [ " ../exampleplugin " ]
diff --git a/examples/declarative/modelviews/objectlistmodel/view.qml b/examples/declarative/modelviews/objectlistmodel/qml/objectlistmodel/view.qml
index 264289f..264289f 100644
--- a/examples/declarative/modelviews/objectlistmodel/view.qml
+++ b/examples/declarative/modelviews/objectlistmodel/qml/objectlistmodel/view.qml