mapwidget: add the "skipReload" guard

This guard is to prevent a meaningless reload on the map marker list,
when the user selects a new dive and nearby dives. The flag is updated
in selectedDivesChanged() which on it's now cannot possibly trigger
changes in the markers, only the selection. The selection of active flags
is already handled by the model and automatically updated in the QML.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
Lubomir I. Ivanov 2017-07-24 22:47:37 +03:00 committed by Dirk Hohndel
parent 64697375cf
commit 7486682f43

View file

@ -12,6 +12,8 @@
#include "mainwindow.h"
#include "divelistview.h"
static bool skipReload = false;
MapWidget *MapWidget::m_instance = NULL;
MapWidget::MapWidget(QWidget *parent) : QQuickWidget(parent)
@ -50,7 +52,8 @@ void MapWidget::repopulateLabels()
void MapWidget::reload()
{
m_mapHelper->reloadMapLocations();
if (!skipReload)
m_mapHelper->reloadMapLocations();
}
void MapWidget::endGetDiveCoordinates()
@ -66,11 +69,11 @@ void MapWidget::prepareForGetDiveCoordinates()
void MapWidget::selectedDivesChanged(QList<int> list)
{
qDebug() << "onSelectedDivesChanged:" << list.size();
/*
skipReload = true;
MainWindow::instance()->dive_list()->unselectDives();
if (!list.empty())
MainWindow::instance()->dive_list()->selectDives(list);
*/
skipReload = false;
}
MapWidget::~MapWidget()