summaryrefslogtreecommitdiff
path: root/examples/location/mapviewer/main.cpp
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@theqtcompany.com>2015-05-01 00:37:59 +0200
committerAlex Blasche <alexander.blasche@theqtcompany.com>2015-05-26 13:24:31 +0000
commit71af9f157462b0bef3ac5b6e8472dd2f1cc14286 (patch)
treec71c2d1067c1e4880a39ca9dbc3a2809eb1f8324 /examples/location/mapviewer/main.cpp
parent265d3d613aaeb9e3c176abf32a1d37c171fe9f21 (diff)
downloadqtlocation-71af9f157462b0bef3ac5b6e8472dd2f1cc14286.tar.gz
Fix typo and remove appPath from mapviewer
appDirPath was used by videoitem which was removed during earlier rewrite of the mapviewer example. Change-Id: I7ac49accbe93fd09c125a45fbeafde660beabf3a Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'examples/location/mapviewer/main.cpp')
-rw-r--r--examples/location/mapviewer/main.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/examples/location/mapviewer/main.cpp b/examples/location/mapviewer/main.cpp
index cda642ec..8b8991fe 100644
--- a/examples/location/mapviewer/main.cpp
+++ b/examples/location/mapviewer/main.cpp
@@ -38,12 +38,9 @@
**
****************************************************************************/
-#include <QtCore/QStringList>
#include <QtCore/QTextStream>
#include <QtGui/QGuiApplication>
#include <QtQml/QQmlApplicationEngine>
-#include <QtQml/QQmlContext>
-#include <QtQuick/QQuickView>
#include <QtQuick/QQuickItem>
static bool parseArgs(QStringList& args, QVariantMap& parameters)
@@ -92,20 +89,19 @@ int main(int argc, char *argv[])
QVariantMap parameters;
QStringList args(QCoreApplication::arguments());
- if (parseArgs(args, parameters)) exit(0);
-
- const QString mainQmlApp = QLatin1String("qrc:///mapviewer.qml");
+ if (parseArgs(args, parameters))
+ return 0;
QQmlApplicationEngine engine;
+ engine.addImportPath(QStringLiteral(":/imports"));
+ engine.load(QUrl(QStringLiteral("qrc:///mapviewer.qml")));
+ QObject::connect(&engine, SIGNAL(quit()), qApp, SLOT(quit()));
- engine.addImportPath(QLatin1String(":/imports"));
- engine.rootContext()->setContextProperty("appDirPath", QCoreApplication::applicationDirPath());
- engine.load(QUrl(mainQmlApp));
QObject *item = engine.rootObjects().first();
Q_ASSERT(item);
- QMetaObject::invokeMethod(item, "initializeProvders",
+
+ QMetaObject::invokeMethod(item, "initializeProviders",
Q_ARG(QVariant, QVariant::fromValue(parameters)));
- QObject::connect(&engine, SIGNAL(quit()), qApp, SLOT(quit()));
return application.exec();
}