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

@@ -424,7 +424,6 @@ public:
QAction *m_parseContextAction = nullptr;
ParseContextWidget *m_parseContextWidget = nullptr;
QToolButton *m_preprocessorButton = nullptr;
MinimizableInfoBars::Actions m_showInfoBarActions;
CppLocalRenaming m_localRenaming;
CppUseSelectionsUpdater m_useSelectionsUpdater;
@@ -555,11 +554,8 @@ void CppEditorWidget::finalizeInitialization()
}
// Toolbar: Actions to show minimized info bars
d->m_showInfoBarActions = MinimizableInfoBars::createShowInfoBarActions([this](QWidget *w) {
return this->insertExtraToolBarWidget(TextEditorWidget::Left, w);
});
connect(&cppEditorDocument()->minimizableInfoBars(), &MinimizableInfoBars::showAction,
this, &CppEditorWidget::onShowInfoBarAction);
d->m_cppEditorDocument->minimizableInfoBars().createShowInfoBarActions(
[this](QWidget *w) { return this->insertExtraToolBarWidget(TextEditorWidget::Left, w); });
d->m_outlineTimer.setInterval(5000);
d->m_outlineTimer.setSingleShot(true);
@@ -672,13 +668,6 @@ void CppEditorWidget::onIfdefedOutBlocksUpdated(unsigned revision,
textDocument()->setIfdefedOutBlocks(ifdefedOutBlocks);
}
void CppEditorWidget::onShowInfoBarAction(const Id &id, bool show)
{
QAction *action = d->m_showInfoBarActions.value(id);
QTC_ASSERT(action, return);
action->setVisible(show);
}
static QString getDocumentLine(QTextDocument *document, int line)
{
if (document)