From 52316229cdd57a7c11092bc0522f0b67192aead7 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Mon, 17 Jul 2017 18:05:28 +0300 Subject: [PATCH] mapwidget.cpp: register the MapLocation and MapLocationModel types Apparently the "safe way" is to register C++ types is before the QML code has loaded. The idea here is that the QML code should know about these type definitions and be able to operate with them. TODO: do the same for the mobile version. Signed-off-by: Lubomir I. Ivanov --- desktop-widgets/mapwidget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/desktop-widgets/mapwidget.cpp b/desktop-widgets/mapwidget.cpp index 9f93faed5..50195319e 100644 --- a/desktop-widgets/mapwidget.cpp +++ b/desktop-widgets/mapwidget.cpp @@ -8,12 +8,15 @@ #include "core/dive.h" #include "core/divesite.h" #include "mobile-widgets/qmlmapwidgethelper.h" +#include "qt-models/maplocationmodel.h" MapWidget *MapWidget::m_instance = NULL; MapWidget::MapWidget(QWidget *parent) : QQuickWidget(parent) { qmlRegisterType("org.subsurfacedivelog.mobile", 1, 0, "MapWidgetHelper"); + qmlRegisterType("org.subsurfacedivelog.mobile", 1, 0, "MapLocationModel"); + qmlRegisterType("org.subsurfacedivelog.mobile", 1, 0, "MapLocation"); setSource(QUrl(QStringLiteral("qrc:/mapwidget-qml"))); setResizeMode(QQuickWidget::SizeRootObjectToView);