MinimizableInfoBars: Move toolbar visibility handling

Remove some coupling between CppEditorWidget and MinimizableInfoBars by
handing the visibility of the toolbar buttons solely within
MinimizableInfoBars.

Change-Id: I5abf59187ea9b37fd13c91d63b2c82a1caa67275
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Eike Ziller
2022-05-02 17:11:18 +02:00
parent b50eb35a17
commit 8bb63ebc9a
4 changed files with 32 additions and 37 deletions

View File

@@ -46,25 +46,24 @@ class MinimizableInfoBars : public QObject
public:
using ActionCreator = std::function<QAction *(QWidget *widget)>;
using Actions = QHash<Utils::Id, QAction *>;
static Actions createShowInfoBarActions(const ActionCreator &actionCreator);
public:
explicit MinimizableInfoBars(Utils::InfoBar &infoBar, QObject *parent = nullptr);
void createShowInfoBarActions(const ActionCreator &actionCreator) const;
void processHasProjectPart(bool hasProjectPart);
signals:
void showAction(const Utils::Id &id, bool show);
private:
void createActions();
void updateNoProjectConfiguration();
void addNoProjectConfigurationEntry(const Utils::Id &id);
private:
Utils::InfoBar &m_infoBar;
QHash<Utils::Id, QAction *> m_actions;
bool m_hasProjectPart = true;
};