diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-07-28 21:19:00 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-07-28 22:06:34 -0700 |
commit | 7c92c7dc0ae658c088b8df83fcf97c3d3a8d8a16 (patch) | |
tree | 990862153a248ce2eb4537505eb342a37f895a73 /desktop-widgets | |
parent | dff6c001d7d397730096c1044e3594d6660f889b (diff) | |
download | subsurface-7c92c7dc0ae658c088b8df83fcf97c3d3a8d8a16.tar.gz |
Map: try to wait for Map to load
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/mapwidget.cpp | 14 | ||||
-rw-r--r-- | desktop-widgets/mapwidget.h | 1 |
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); |