From 7486682f43b2c83d02bed52a2a6c3c7ce8d68426 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Mon, 24 Jul 2017 22:47:37 +0300 Subject: 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 --- desktop-widgets/mapwidget.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/mapwidget.cpp b/desktop-widgets/mapwidget.cpp index d5a926f59..4ac394b4e 100644 --- a/desktop-widgets/mapwidget.cpp +++ b/desktop-widgets/mapwidget.cpp @@ -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 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() -- cgit v1.2.3-70-g09d2