mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
mapwidget.cpp: obtain a reference of the MapWidgetHelper from QML
Use findChild() to obtain the only MapWidgetHelper object created in the MapWidget.qml. Store the reference as a member variable - m_mapHelper. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
0d75dec0fa
commit
99c2bf6290
2 changed files with 3 additions and 0 deletions
|
@ -18,6 +18,7 @@ MapWidget::MapWidget(QWidget *parent) : QQuickWidget(parent)
|
|||
setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||
|
||||
m_rootItem = qobject_cast<QQuickItem *>(rootObject());
|
||||
m_mapHelper = rootObject()->findChild<MapWidgetHelper *>();
|
||||
}
|
||||
|
||||
void MapWidget::centerOnDiveSite(struct dive_site *ds)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
class QResizeEvent;
|
||||
class QQuickItem;
|
||||
class MapWidgetHelper;
|
||||
struct dive_site;
|
||||
|
||||
class MapWidget : public QQuickWidget {
|
||||
|
@ -33,6 +34,7 @@ public slots:
|
|||
private:
|
||||
static MapWidget *m_instance;
|
||||
QQuickItem *m_rootItem;
|
||||
MapWidgetHelper *m_mapHelper;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue