From d09ee2d1f815932cb4eeffe5627ab3d13818a8c9 Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Mon, 7 Aug 2023 22:36:24 +0200 Subject: [PATCH 1/2] Update the IPB beacons table only when the dialog is visible --- plugins/feature/map/mapibpbeacondialog.cpp | 16 ++++++++++++++-- plugins/feature/map/mapibpbeacondialog.h | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/plugins/feature/map/mapibpbeacondialog.cpp b/plugins/feature/map/mapibpbeacondialog.cpp index 132f240a8..942a887af 100644 --- a/plugins/feature/map/mapibpbeacondialog.cpp +++ b/plugins/feature/map/mapibpbeacondialog.cpp @@ -32,7 +32,6 @@ MapIBPBeaconDialog::MapIBPBeaconDialog(MapGUI *gui, QWidget* parent) : ui->setupUi(this); connect(&m_timer, &QTimer::timeout, this, &MapIBPBeaconDialog::updateTime); m_timer.setInterval(1000); - m_timer.start(); ui->beacons->setRowCount(IBPBeacon::m_frequencies.size()); for (int row = 0; row < IBPBeacon::m_frequencies.size(); row++) { @@ -44,7 +43,6 @@ MapIBPBeaconDialog::MapIBPBeaconDialog(MapGUI *gui, QWidget* parent) : ui->beacons->setItem(row, IBP_BEACON_COL_DISTANCE, new QTableWidgetItem("")); } resizeTable(); - updateTable(QTime::currentTime()); } MapIBPBeaconDialog::~MapIBPBeaconDialog() @@ -126,3 +124,17 @@ void MapIBPBeaconDialog::updateTime() updateTable(t); } } + +void MapIBPBeaconDialog::showEvent(QShowEvent *event) +{ + (void) event; + updateTable(QTime::currentTime()); + updateTime(); + m_timer.start(); +} + +void MapIBPBeaconDialog::hideEvent(QHideEvent *event) +{ + (void) event; + m_timer.stop(); +} diff --git a/plugins/feature/map/mapibpbeacondialog.h b/plugins/feature/map/mapibpbeacondialog.h index 8712b2d04..f4d5b5945 100644 --- a/plugins/feature/map/mapibpbeacondialog.h +++ b/plugins/feature/map/mapibpbeacondialog.h @@ -43,6 +43,8 @@ private slots: void accept(); void on_beacons_cellDoubleClicked(int row, int column); void updateTime(); + void showEvent(QShowEvent *event); + void hideEvent(QHideEvent *event); private: MapGUI *m_gui; From b60eb5513d7025a2824d474427159c5cd296dd8f Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sun, 14 Apr 2024 16:41:58 +0200 Subject: [PATCH 2/2] Prevent the dialogs to be hidden behind the main window This also menas that when the main window is closed, the dialogs get closed automatically, and not only when the map window is closed. --- plugins/feature/map/mapgui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/feature/map/mapgui.cpp b/plugins/feature/map/mapgui.cpp index 8bd3d6a0b..a5056e600 100644 --- a/plugins/feature/map/mapgui.cpp +++ b/plugins/feature/map/mapgui.cpp @@ -198,9 +198,9 @@ MapGUI::MapGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *featur m_polygonMapModel(this), m_polylineMapModel(this), m_beacons(nullptr), - m_beaconDialog(this), - m_ibpBeaconDialog(this), - m_radioTimeDialog(this), + m_beaconDialog(this, this), + m_ibpBeaconDialog(this, this), + m_radioTimeDialog(this, this), m_cesium(nullptr), m_legend(nullptr), m_nasaWidget(nullptr),