summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor/cppoutline.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2021-06-08 14:28:25 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2021-07-01 08:36:20 +0000
commitc0a44be27bce4dbfc64218db4b2a2caf27718a3c (patch)
tree70c0bbf4304c86630d1361554901e7dd5d7a1376 /src/plugins/cppeditor/cppoutline.cpp
parentf4a33100591f0a6b2d9c79877540dd8637a6eaf7 (diff)
downloadqt-creator-c0a44be27bce4dbfc64218db4b2a2caf27718a3c.tar.gz
ClangCodeModel: Provide outline via clangd
Note that we used to encode the information about symbol visibility and static-ness in the icons, which we can't do anymore, because clangd does not provide this information. On the upside, this change likely fixes a ton of bugs, as our own outline was rather "quirky". Change-Id: I099f11ec4e3c6f52cd461fb43080bbdde3bed5e5 Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/cppoutline.cpp')
-rw-r--r--src/plugins/cppeditor/cppoutline.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/cppeditor/cppoutline.cpp b/src/plugins/cppeditor/cppoutline.cpp
index c071f61a43..758b11b1fb 100644
--- a/src/plugins/cppeditor/cppoutline.cpp
+++ b/src/plugins/cppeditor/cppoutline.cpp
@@ -28,6 +28,7 @@
#include "cppeditor.h"
#include <cpptools/cppeditoroutline.h>
+#include <cpptools/cppmodelmanager.h>
#include <cpptools/cppoverviewmodel.h>
#include <texteditor/textdocument.h>
@@ -212,7 +213,10 @@ bool CppOutlineWidget::syncCursor()
bool CppOutlineWidgetFactory::supportsEditor(Core::IEditor *editor) const
{
- return qobject_cast<CppEditor*>(editor);
+ const auto cppEditor = qobject_cast<CppEditor*>(editor);
+ if (!cppEditor)
+ return false;
+ return CppTools::CppModelManager::supportsOutline(cppEditor->textDocument());
}
TextEditor::IOutlineWidget *CppOutlineWidgetFactory::createWidget(Core::IEditor *editor)