added detection for signal aboutToQuit when system shutdown

This commit is contained in:
サイバーキラー 2023-03-18 22:44:13 +00:00 committed by Adam Honse
parent a4130ba373
commit 1f9948b4c2
2 changed files with 15 additions and 0 deletions

View file

@ -509,6 +509,11 @@ OpenRGBDialog2::OpenRGBDialog2(QWidget *parent) : QMainWindow(parent), ui(new Op
AddConsolePage();
}
/*-----------------------------------------------------*\
| Connect aboutToQuit signal to handleAboutToQuit |
\*-----------------------------------------------------*/
connect(qApp, &QCoreApplication::aboutToQuit, this, &OpenRGBDialog2::handleAboutToQuit);
}
OpenRGBDialog2::~OpenRGBDialog2()
@ -544,6 +549,15 @@ OpenRGBDialog2::~OpenRGBDialog2()
delete ui;
}
void OpenRGBDialog2::handleAboutToQuit()
{
QCloseEvent* closeEvent = new QCloseEvent;
this->closeEvent(closeEvent);
delete closeEvent;
}
void OpenRGBDialog2::changeEvent(QEvent *event)
{
if(event->type() == QEvent::LanguageChange)

View file

@ -70,6 +70,7 @@ signals:
public slots:
void changeEvent(QEvent *event);
void SetTrayIcon(bool tray_icon);
void handleAboutToQuit();
private:
const char* context = "Ui::OpenRGBDialog2";