summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/mapwidget.cpp14
-rw-r--r--desktop-widgets/mapwidget.h1
2 files changed, 13 insertions, 2 deletions
diff --git a/desktop-widgets/mapwidget.cpp b/desktop-widgets/mapwidget.cpp
index adda11c26..34f7ed217 100644
--- a/desktop-widgets/mapwidget.cpp
+++ b/desktop-widgets/mapwidget.cpp
@@ -22,15 +22,25 @@ MapWidget::MapWidget(QWidget *parent) : QQuickWidget(parent)
qmlRegisterType<MapLocationModel>("org.subsurfacedivelog.mobile", 1, 0, "MapLocationModel");
qmlRegisterType<MapLocation>("org.subsurfacedivelog.mobile", 1, 0, "MapLocation");
+ connect(this, &QQuickWidget::statusChanged, this, &MapWidget::doneLoading);
setSource(QUrl(QStringLiteral("qrc:/MapWidget.qml")));
+}
+
+void MapWidget::doneLoading(QQuickWidget::Status status)
+{
+ if (status != QQuickWidget::Ready) {
+ qDebug() << "MapWidget status" << status;
+ return;
+ }
+ qDebug() << "MapWidget ready";
setResizeMode(QQuickWidget::SizeRootObjectToView);
m_rootItem = qobject_cast<QQuickItem *>(rootObject());
m_mapHelper = rootObject()->findChild<MapWidgetHelper *>();
connect(m_mapHelper, SIGNAL(selectedDivesChanged(QList<int>)),
- this, SLOT(selectedDivesChanged(QList<int>)));
+ this, SLOT(selectedDivesChanged(QList<int>)));
connect(m_mapHelper, SIGNAL(coordinatesChanged()),
- this, SLOT(coordinatesChangedLocal()));
+ this, SLOT(coordinatesChangedLocal()));
}
void MapWidget::centerOnDiveSite(struct dive_site *ds)
diff --git a/desktop-widgets/mapwidget.h b/desktop-widgets/mapwidget.h
index d104da1a3..bb861d301 100644
--- a/desktop-widgets/mapwidget.h
+++ b/desktop-widgets/mapwidget.h
@@ -34,6 +34,7 @@ public slots:
void prepareForGetDiveCoordinates();
void selectedDivesChanged(QList<int>);
void coordinatesChangedLocal();
+ void doneLoading(QQuickWidget::Status status);
private:
void setEditMode(bool editMode);