diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2022-02-12 15:37:43 +0200 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2022-02-12 16:04:57 +0200 |
commit | e7fc50681e99e3c726db2bc4d3d425ed8a0fc6b3 (patch) | |
tree | 74772a02da43bf294fa5e0e3e4105fef0fce897f | |
parent | b6b7815ddcff53177bb1f6318b39a4134cf42cb1 (diff) |
qt: Override BitcoinApplication::event() to handle QEvent::Quit
-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 6a2781079c..497805f2bb 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -450,6 +450,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; |