MainWindow: ask confirmation before closing Qt Creator

When working with multiple windows, pressing the close button multiple
times can close Qt Creator too.

This patch adds a system option, asking for a confirmation before
closing the IDE. By default it's not enabled.

Fixes: QTCREATORBUG-7637
Change-Id: Ifc5e8c97511f9227ce0634c8a7064d95775c76c2
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Antonio Di Monaco
2019-11-26 11:20:02 +01:00
committed by André Hartmann
parent 70b226144f
commit 6e4ca8b6af
4 changed files with 47 additions and 0 deletions

View File

@@ -102,6 +102,9 @@ public:
void updateAdditionalContexts(const Context &remove, const Context &add,
ICore::ContextPriority priority);
bool askConfirmationBeforeExit() const;
void setAskConfirmationBeforeExit(bool ask);
void setOverrideColor(const QColor &color);
QStringList additionalAboutInformation() const;
@@ -194,6 +197,7 @@ private:
QToolButton *m_toggleLeftSideBarButton = nullptr;
QToolButton *m_toggleRightSideBarButton = nullptr;
bool m_askConfirmationBeforeExit = false;
QColor m_overrideColor;
QList<std::function<bool()>> m_preCloseListeners;
};