From 080a3f5ae356b202d0ea0fe15985e20372d30f6b Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Wed, 23 Mar 2022 09:04:04 +0000 Subject: [PATCH] ADS-B: Remove device set refresh button, as now automatic. Fix possible crash on close. --- plugins/feature/map/mapgui.cpp | 9 ++++++--- plugins/feature/map/mapgui.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/feature/map/mapgui.cpp b/plugins/feature/map/mapgui.cpp index b893d838e..3c9db46cc 100644 --- a/plugins/feature/map/mapgui.cpp +++ b/plugins/feature/map/mapgui.cpp @@ -263,11 +263,15 @@ MapGUI::MapGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *featur displaySettings(); applySettings(true); + connect(&m_redrawMapTimer, &QTimer::timeout, this, &MapGUI::redrawMap); + m_redrawMapTimer.setSingleShot(true); ui->map->installEventFilter(this); } MapGUI::~MapGUI() { + disconnect(&m_redrawMapTimer, &QTimer::timeout, this, &MapGUI::redrawMap); + m_redrawMapTimer.stop(); //m_cesium->deleteLater(); delete m_cesium; if (m_templateServer) @@ -281,6 +285,7 @@ MapGUI::~MapGUI() delete m_webServer; } delete ui; + ui = nullptr; } // Update a map item or image @@ -707,9 +712,7 @@ void MapGUI::showEvent(QShowEvent *event) { // Workaround for https://bugreports.qt.io/browse/QTBUG-100333 // MapQuickItems can be in wrong position when window is first displayed - QTimer::singleShot(500, [this] { - redrawMap(); - }); + m_redrawMapTimer.start(500); } } diff --git a/plugins/feature/map/mapgui.h b/plugins/feature/map/mapgui.h index 51d2f00c9..dce30ea15 100644 --- a/plugins/feature/map/mapgui.h +++ b/plugins/feature/map/mapgui.h @@ -110,6 +110,7 @@ private: MapRadioTimeDialog m_radioTimeDialog; quint16 m_osmPort; OSMTemplateServer *m_templateServer; + QTimer m_redrawMapTimer; CesiumInterface *m_cesium; WebServer *m_webServer;