summaryrefslogtreecommitdiffstats
path: root/examples/declarative/modelviews/objectlistmodel/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/modelviews/objectlistmodel/main.cpp')
-rw-r--r--examples/declarative/modelviews/objectlistmodel/main.cpp18
1 files changed, 7 insertions, 11 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();
}