summaryrefslogtreecommitdiff
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
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>
-rw-r--r--examples/location/mapviewer/main.cpp18
-rw-r--r--examples/location/mapviewer/mapviewer.qml7
2 files changed, 10 insertions, 15 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();
}
diff --git a/examples/location/mapviewer/mapviewer.qml b/examples/location/mapviewer/mapviewer.qml
index 491bc47f..fb9d462d 100644
--- a/examples/location/mapviewer/mapviewer.qml
+++ b/examples/location/mapviewer/mapviewer.qml
@@ -137,10 +137,9 @@ ApplicationWindow {
function getPlugins()
{
var plugin = Qt.createQmlObject ('import QtLocation 5.3; Plugin {}', appWindow)
- var tempPlugin
var myArray = new Array()
- for (var i = 0; i<plugin.availableServiceProviders.length; i++){
- tempPlugin = Qt.createQmlObject ('import QtLocation 5.3; Plugin {name: "' + plugin.availableServiceProviders[i]+ '"}', appWindow)
+ for (var i = 0; i<plugin.availableServiceProviders.length; i++) {
+ var tempPlugin = Qt.createQmlObject ('import QtLocation 5.3; Plugin {name: "' + plugin.availableServiceProviders[i]+ '"}', appWindow)
if (tempPlugin.supportsMapping())
myArray.push(tempPlugin.name)
}
@@ -148,7 +147,7 @@ ApplicationWindow {
return myArray
}
- function initializeProvders(pluginParameters)
+ function initializeProviders(pluginParameters)
{
var parameters = new Array()
for (var prop in pluginParameters){