mapwidget: connect the helper selectedDivesChanged() signal

The selectedDivesChanged() signal from MapWidgetHelper is connected
to a local slot. One problem here is that this crashes with the calls to
DiveListView().

The dive list widget triggers events that call reload() on the MapWidget
(same happens for Marble's Globe class) and that crashes somewhere in
the QML shared library. TODO: investigate.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
Lubomir I. Ivanov 2017-07-24 21:47:19 +03:00 committed by Dirk Hohndel
parent c078e350e0
commit 64697375cf
2 changed files with 16 additions and 0 deletions

View file

@ -9,6 +9,8 @@
#include "core/divesite.h"
#include "mobile-widgets/qmlmapwidgethelper.h"
#include "qt-models/maplocationmodel.h"
#include "mainwindow.h"
#include "divelistview.h"
MapWidget *MapWidget::m_instance = NULL;
@ -23,6 +25,8 @@ MapWidget::MapWidget(QWidget *parent) : QQuickWidget(parent)
m_rootItem = qobject_cast<QQuickItem *>(rootObject());
m_mapHelper = rootObject()->findChild<MapWidgetHelper *>();
connect(m_mapHelper, SIGNAL(selectedDivesChanged(QList<int>)),
this, SLOT(selectedDivesChanged(QList<int>)));
}
void MapWidget::centerOnDiveSite(struct dive_site *ds)
@ -59,6 +63,16 @@ void MapWidget::prepareForGetDiveCoordinates()
// TODO;
}
void MapWidget::selectedDivesChanged(QList<int> list)
{
qDebug() << "onSelectedDivesChanged:" << list.size();
/*
MainWindow::instance()->dive_list()->unselectDives();
if (!list.empty())
MainWindow::instance()->dive_list()->selectDives(list);
*/
}
MapWidget::~MapWidget()
{
m_instance = NULL;

View file

@ -3,6 +3,7 @@
#define MAPWIDGET_H
#include <QQuickWidget>
#include <QList>
#undef IGNORE
@ -31,6 +32,7 @@ public slots:
void endGetDiveCoordinates();
void repopulateLabels();
void prepareForGetDiveCoordinates();
void selectedDivesChanged(QList<int>);
private:
static MapWidget *m_instance;