diff options
-rw-r--r-- | src/qt/bitcoin.cpp | 10 | ||||
-rw-r--r-- | src/qt/bitcoin.h | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index eb31287c56..ac313bdb9d 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -454,6 +454,16 @@ WId BitcoinApplication::getMainWinId() const return window->winId(); } +bool BitcoinApplication::event(QEvent* e) +{ + if (e->type() == QEvent::Quit) { + requestShutdown(); + return true; + } + + return QApplication::event(e); +} + static void SetupUIArgs(ArgsManager& argsman) { argsman.AddArg("-choosedatadir", strprintf("Choose data directory on startup (default: %u)", DEFAULT_CHOOSE_DATADIR), ArgsManager::ALLOW_ANY, OptionsCategory::GUI); diff --git a/src/qt/bitcoin.h b/src/qt/bitcoin.h index 0703c6dcb9..7a6aa5cdc9 100644 --- a/src/qt/bitcoin.h +++ b/src/qt/bitcoin.h @@ -92,6 +92,9 @@ Q_SIGNALS: void splashFinished(); void windowShown(BitcoinGUI* window); +protected: + bool event(QEvent* e) override; + private: std::optional<InitExecutor> m_executor; OptionsModel *optionsModel; |