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.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/declarative/modelviews/objectlistmodel/main.cpp b/examples/declarative/modelviews/objectlistmodel/main.cpp
index 25de8d1..89c22a1 100644
--- a/examples/declarative/modelviews/objectlistmodel/main.cpp
+++ b/examples/declarative/modelviews/objectlistmodel/main.cpp
@@ -53,20 +53,21 @@
model in QML
*/
+//![0]
int main(int argc, char ** argv)
{
QApplication app(argc, argv);
- QDeclarativeView view;
-
QList<QObject*> dataList;
dataList.append(new DataObject("Item 1", "red"));
dataList.append(new DataObject("Item 2", "green"));
dataList.append(new DataObject("Item 3", "blue"));
dataList.append(new DataObject("Item 4", "yellow"));
+ QDeclarativeView view;
QDeclarativeContext *ctxt = view.rootContext();
ctxt->setContextProperty("myModel", QVariant::fromValue(dataList));
+//![0]
view.setSource(QUrl("qrc:view.qml"));
view.show();