Hello everyone!
I've got the problem with passing property value through C++
to QML
. My project is desktop application that must works with maps under Windows
. So, after reading docs I found the best solution via QML
using Qt Location. I chose OSM Plugin.
Everything works good but I need to manually locate cache into custom directory. So for that I want to pass such property (cachePath
) value from C++
code to QML
.
Part of C++ code:
QQuickView *view = new QQuickView;
view->rootContext()->setContextProperty("cachePath", "C:/111/");
view->setSource(QUrl(QStringLiteral("qrc:/qml/OSMView.qml")));
Important part of QML code:
Map
{
zoomLevel: 10
plugin: Plugin
{
name: "osm"
PluginParameter { name: "osm.mapping.highdpi_tiles"; value: true }
PluginParameter { name: "osm.mapping.offline.directory"; value: cachePath }
PluginParameter { name: "osm.mapping.cache.directory"; value: cachePath }
}
<... nevermind ...>
}
So debug said that everything alright and property is passed. But there is no new tiles after work with maps in this custom directory.
But, if I type manually value: "C:/111/"
- everything works fine and directory is replenished with new cache tiles.
What could be the problem?
Thanks for advance!