diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-12-22 12:42:14 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-12-22 12:16:41 +0000 |
commit | 1091899a3e440d1c46716b3a6f6731bff5555dcd (patch) | |
tree | 46ae0fce6167ca40259362f00b65667287fe0323 /tools | |
parent | 645315c060c75d0d212c0339c17a1e0e6ac9632b (diff) |
testcon: Fix hangs when closing the window.
When loading controls using the same version of Qt,
QGuiApplication::quitOnLastWindowClosed is set to false.
Overwrite MainWindow::closeEvent() to fix this.
Task-number: QTBUG-49712
Change-Id: I7425cf2a4a70353e017ed5cad463e1b66b819247
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testcon/mainwindow.cpp | 9 | ||||
-rw-r--r-- | tools/testcon/mainwindow.h | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/tools/testcon/mainwindow.cpp b/tools/testcon/mainwindow.cpp index a886871..826912e 100644 --- a/tools/testcon/mainwindow.cpp +++ b/tools/testcon/mainwindow.cpp @@ -43,6 +43,7 @@ #include <QtWidgets/QFileDialog> #include <QtWidgets/QInputDialog> #include <QtWidgets/QMessageBox> +#include <QtGui/QCloseEvent> #include <QtCore/QDebug> #include <QtCore/qt_windows.h> #include <ActiveQt/QAxScriptManager> @@ -147,6 +148,14 @@ bool MainWindow::addControlFromClsid(const QString &clsid) return result; } +void MainWindow::closeEvent(QCloseEvent *e) +{ + // Controls using the same version of Qt may set this to false, causing hangs. + QGuiApplication::setQuitOnLastWindowClosed(true); + m_mdiArea->closeAllSubWindows(); + e->accept(); +} + void MainWindow::on_actionFileNew_triggered() { QAxSelect select(this); diff --git a/tools/testcon/mainwindow.h b/tools/testcon/mainwindow.h index cc0f361..af5454d 100644 --- a/tools/testcon/mainwindow.h +++ b/tools/testcon/mainwindow.h @@ -61,6 +61,9 @@ public: bool addControlFromFile(const QString &fileName); bool loadScript(const QString &file); +protected: + void closeEvent(QCloseEvent *) Q_DECL_OVERRIDE; + protected slots: void on_actionFileNew_triggered(); void on_actionFileLoad_triggered(); |