forked from qt-creator/qt-creator
LanguageClient: pass BaseTextEditor to outline generator
Change-Id: Id0e123f5614f3884bf3beaeafefd0ccbd1192d55 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -274,15 +274,12 @@ private:
|
||||
const DocumentUri m_uri;
|
||||
};
|
||||
|
||||
Utils::TreeViewComboBox *LanguageClientOutlineWidgetFactory::createComboBox(Client *client,
|
||||
Core::IEditor *editor)
|
||||
Utils::TreeViewComboBox *LanguageClientOutlineWidgetFactory::createComboBox(
|
||||
Client *client, TextEditor::BaseTextEditor *editor)
|
||||
{
|
||||
auto textEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor);
|
||||
QTC_ASSERT(textEditor, return nullptr);
|
||||
if (!client || !client->supportsDocumentSymbols(textEditor->textDocument()))
|
||||
if (client && client->supportsDocumentSymbols(editor->textDocument()))
|
||||
return new OutlineComboBox(client, editor);
|
||||
return nullptr;
|
||||
|
||||
return new OutlineComboBox(client, textEditor);
|
||||
}
|
||||
|
||||
OutlineComboBox::OutlineComboBox(Client *client, TextEditor::BaseTextEditor *editor)
|
||||
|
@@ -27,7 +27,10 @@
|
||||
|
||||
#include <texteditor/ioutlinewidget.h>
|
||||
|
||||
namespace TextEditor { class TextDocument; }
|
||||
namespace TextEditor {
|
||||
class TextDocument;
|
||||
class BaseTextEditor;
|
||||
} // namespace TextEditor
|
||||
namespace Utils { class TreeViewComboBox; }
|
||||
|
||||
namespace LanguageClient {
|
||||
@@ -39,7 +42,7 @@ class LanguageClientOutlineWidgetFactory : public TextEditor::IOutlineWidgetFact
|
||||
public:
|
||||
using IOutlineWidgetFactory::IOutlineWidgetFactory;
|
||||
|
||||
static Utils::TreeViewComboBox *createComboBox(Client *client, Core::IEditor *editor);
|
||||
static Utils::TreeViewComboBox *createComboBox(Client *client, TextEditor::BaseTextEditor *editor);
|
||||
// IOutlineWidgetFactory interface
|
||||
public:
|
||||
bool supportsEditor(Core::IEditor *editor) const override;
|
||||
|
@@ -288,7 +288,8 @@ void updateEditorToolBar(Core::IEditor *editor)
|
||||
}
|
||||
|
||||
if (!extras->m_client) {
|
||||
if (QWidget *comboBox = LanguageClientOutlineWidgetFactory::createComboBox(client, editor)) {
|
||||
QWidget *comboBox = LanguageClientOutlineWidgetFactory::createComboBox(client, textEditor);
|
||||
if (comboBox) {
|
||||
extras->m_client = client;
|
||||
extras->m_outlineAction = widget->insertExtraToolBarWidget(TextEditorWidget::Left,
|
||||
comboBox);
|
||||
|
Reference in New Issue
Block a user