CppEditor: move outline model to document

This way we only have one model per document instead of one per editor.
Additionally we further separate the outline views (combobox and side
pane) from the actual model.

Change-Id: I9705716b5c9f8f19f75708ec73d7c3b3c5de586f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
David Schulz
2022-08-15 13:06:12 +02:00
parent 4a79623959
commit 5b3b1a60a1
9 changed files with 95 additions and 100 deletions

View File

@@ -462,8 +462,6 @@ void CppEditorWidget::finalizeInitialization()
this, &CppEditorWidget::onCodeWarningsUpdated);
connect(d->m_cppEditorDocument, &CppEditorDocument::ifdefedOutBlocksUpdated,
this, &CppEditorWidget::onIfdefedOutBlocksUpdated);
connect(d->m_cppEditorDocument, &CppEditorDocument::cppDocumentUpdated,
this, &CppEditorWidget::onCppDocumentUpdated);
connect(d->m_cppEditorDocument, &CppEditorDocument::semanticInfoUpdated,
this, [this](const SemanticInfo &info) { updateSemanticInfo(info); });
@@ -552,10 +550,8 @@ void CppEditorWidget::finalizeInitialization()
d->m_outlineTimer.setSingleShot(true);
connect(&d->m_outlineTimer, &QTimer::timeout, this, [this] {
d->m_outlineAction->setVisible(d->shouldOfferOutline());
if (d->m_outlineAction->isVisible()) {
d->m_cppEditorOutline->update();
d->m_cppEditorOutline->updateIndex();
}
if (d->m_outlineAction->isVisible())
d->m_cppEditorDocument->updateOutline();
});
connect(&ClangdSettings::instance(), &ClangdSettings::changed,
&d->m_outlineTimer, qOverload<>(&QTimer::start));
@@ -571,8 +567,6 @@ void CppEditorWidget::finalizeInitializationAfterDuplication(TextEditorWidget *o
if (cppEditorWidget->isSemanticInfoValidExceptLocalUses())
updateSemanticInfo(cppEditorWidget->semanticInfo());
if (d->shouldOfferOutline())
d->m_cppEditorOutline->update();
const Id selectionKind = CodeWarningsSelection;
setExtraSelections(selectionKind, cppEditorWidget->extraSelections(selectionKind));
@@ -632,12 +626,6 @@ void CppEditorWidget::selectAll()
TextEditorWidget::selectAll();
}
void CppEditorWidget::onCppDocumentUpdated()
{
if (d->shouldOfferOutline())
d->m_cppEditorOutline->update();
}
void CppEditorWidget::onCodeWarningsUpdated(unsigned revision,
const QList<QTextEdit::ExtraSelection> selections,
const RefactorMarkers &refactorMarkers)