Make closeApp work with no event

And exit using QApplication.exit so we don't mess with window events to exit the app
This commit is contained in:
Luis Ángel San Martín 2019-09-21 12:11:03 +02:00
parent 7ac331ed41
commit ef8216b338
2 changed files with 12 additions and 5 deletions

View File

@ -2314,11 +2314,12 @@ extern Startup *s;
void LibraryWindow::closeEvent(QCloseEvent *event) void LibraryWindow::closeEvent(QCloseEvent *event)
{ {
if (!trayIconController->handleCloseToTrayIcon(event)) { if (!trayIconController->handleCloseToTrayIcon(event)) {
closeApp(event); event->accept();
closeApp();
} }
} }
void LibraryWindow::closeApp(QCloseEvent *event) void LibraryWindow::prepareToCloseApp()
{ {
s->stop(); s->stop();
settings->setValue(MAIN_WINDOW_GEOMETRY, saveGeometry()); settings->setValue(MAIN_WINDOW_GEOMETRY, saveGeometry());
@ -2327,8 +2328,13 @@ void LibraryWindow::closeApp(QCloseEvent *event)
sideBar->close(); sideBar->close();
QApplication::instance()->processEvents(); QApplication::instance()->processEvents();
event->accept(); }
QMainWindow::closeEvent(event);
void LibraryWindow::closeApp()
{
prepareToCloseApp();
qApp->exit(0);
} }
void LibraryWindow::showNoLibrariesWidget() void LibraryWindow::showNoLibrariesWidget()

View File

@ -388,7 +388,8 @@ public slots:
void checkMaxNumLibraries(); void checkMaxNumLibraries();
void showErrorUpgradingLibrary(const QString &path); void showErrorUpgradingLibrary(const QString &path);
void closeApp(QCloseEvent *event); void prepareToCloseApp();
void closeApp();
private: private:
//fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309 //fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309