qt: Override BitcoinApplication::event() to handle QEvent::Quit

This commit is contained in:
Hennadii Stepanov 2022-02-12 15:37:43 +02:00
parent b6b7815ddc
commit e7fc50681e
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 13 additions and 0 deletions

View file

@ -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);

View file

@ -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;