From ad03cfd1b98d537de381121af00ff573990d627a Mon Sep 17 00:00:00 2001 From: Keshav Bhatt Date: Mon, 29 May 2023 16:02:43 +0530 Subject: [PATCH] fix: prevent quiting if systemtray available and used in old QT versions --- src/mainwindow.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 14b8f77..0689b3f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -327,7 +327,6 @@ void MainWindow::resizeFix() { } void MainWindow::closeEvent(QCloseEvent *event) { - QMainWindow::closeEvent(event); m_settings.setValue("geometry", saveGeometry()); @@ -342,6 +341,14 @@ void MainWindow::closeEvent(QCloseEvent *event) { m_settingsWidget->quickResultCheckBoxChecked()); m_trayManager->updateMenu(false); + + if (QSystemTrayIcon::isSystemTrayAvailable()) { + this->hide(); + event->ignore(); + return; + } + + QMainWindow::closeEvent(event); } void MainWindow::resizeEvent(QResizeEvent *event) {