From 342164dfb5ee90cd2aa66e9f7b08af5041b08895 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Fri, 17 Sep 2021 03:00:33 -0700 Subject: [PATCH] Forms: Use QHideEvent instead of QCloseEvent QCloseEvent is the wrong event to use here. If the `Ok` button is pressed for example, QCloseEvent is not emitted. QHideEvent is always called when the dialog is hidden. --- src/forms/SettingsDialog.cpp | 4 +++- src/forms/SettingsDialog.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/forms/SettingsDialog.cpp b/src/forms/SettingsDialog.cpp index cb86e5c3..7a5992c4 100644 --- a/src/forms/SettingsDialog.cpp +++ b/src/forms/SettingsDialog.cpp @@ -90,8 +90,10 @@ void SettingsDialog::showEvent(QShowEvent *event) sessionTableTimer->start(1000); } -void SettingsDialog::closeEvent(QCloseEvent *event) +void SettingsDialog::hideEvent(QHideEvent *event) { + UNUSED_PARAMETER(event); + if (sessionTableTimer->isActive()) sessionTableTimer->stop(); diff --git a/src/forms/SettingsDialog.h b/src/forms/SettingsDialog.h index 2c16fd92..c6679def 100644 --- a/src/forms/SettingsDialog.h +++ b/src/forms/SettingsDialog.h @@ -16,7 +16,7 @@ public: explicit SettingsDialog(QWidget* parent = 0); ~SettingsDialog(); void showEvent(QShowEvent *event); - void closeEvent(QCloseEvent *event); + void hideEvent(QHideEvent *event); void ToggleShowHide(); private Q_SLOTS: