diff options
-rw-r--r-- | gui/application.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gui/application.cc b/gui/application.cc index 58dc23eb..aece5d2a 100644 --- a/gui/application.cc +++ b/gui/application.cc @@ -27,11 +27,24 @@ NEXTPNR_NAMESPACE_BEGIN +#ifdef _WIN32 +#include <windows.h> +BOOL WINAPI WinHandler(DWORD dwCtrlType) +{ + if (dwCtrlType == CTRL_C_EVENT) + qApp->quit(); + return TRUE; +} +#endif + Application::Application(int &argc, char **argv) : QApplication(argc, argv) { QSurfaceFormat fmt; fmt.setSamples(10); QSurfaceFormat::setDefaultFormat(fmt); +#ifdef _WIN32 + SetConsoleCtrlHandler((PHANDLER_ROUTINE)WinHandler, TRUE); +#endif } bool Application::notify(QObject *receiver, QEvent *event) |