Solved OSM QML map embedded in widget
-
Hi,
I try to make a QML map embedded in a widget.
Here is my code:QQuickWidget* widget = new QQuickWidget(); widget->setSource(QUrl(QStringLiteral("qmlMain.qml"))); ui.gridLayout->addWidget(widget);
gridLayout was added in the QtDesigner
and for the QML part :
import QtQuick 2.0 import QtQuick.Window 2.0 import QtLocation 5.6 import QtPositioning 5.6 Item { id: qmlMap Plugin { id: osmPlugin name: "osm" } Map { anchors.fill: parent plugin: osmPlugin center: QtPositioning.coordinate(59.91, 10.75) // Oslo zoomLevel: 10 } }
But all I can see is a blank widget
This work perfectly in a QML application, and if the QML file doesn't contain a map (label, buttons etc...)
I am using VC2017 and I have correctly added QtLocation and QtPosition libs in the project.
What am I missing ?
thx
-
@seb21 said in OSM QML map embedded in widget:
QQuickWidget* widget = new QQuickWidget(); widget->setSource(QUrl(QStringLiteral("qmlMain.qml"))); widget->setResizeMode( QQuickWidget::SizeRootObjectToView ); ui.gridLayout->addWidget(widget);
-
@seb21 said in OSM QML map embedded in widget:
QQuickWidget* widget = new QQuickWidget(); widget->setSource(QUrl(QStringLiteral("qmlMain.qml"))); widget->setResizeMode( QQuickWidget::SizeRootObjectToView ); ui.gridLayout->addWidget(widget);
-
damn ! thx a lot