TextEditor: Don't export KSyntaxHighlighting

Change-Id: I84fa8c758af412d8847391a628deac60279b9448
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-10-17 15:13:45 +02:00
parent ab23ee98f9
commit fdeff13ca3
4 changed files with 11 additions and 7 deletions

View File

@@ -285,8 +285,9 @@ CompilerWidget::CompilerWidget(const std::shared_ptr<SourceSettings> &sourceSett
m_asmEditor = new AsmEditorWidget(undoStack); m_asmEditor = new AsmEditorWidget(undoStack);
m_asmDocument = QSharedPointer<TextDocument>(new TextDocument); m_asmDocument = QSharedPointer<TextDocument>(new TextDocument);
m_asmEditor->setTextDocument(m_asmDocument); m_asmEditor->setTextDocument(m_asmDocument);
m_asmEditor->configureGenericHighlighter( QTC_ASSERT_EXPECTED(m_asmEditor->configureGenericHighlighter("Intel x86 (NASM)"),
TextEditor::Highlighter::definitionForName("Intel x86 (NASM)")); m_asmEditor->configureGenericHighlighter(
Utils::mimeTypeForName("text/x-asm")));
m_asmEditor->setReadOnly(true); m_asmEditor->setReadOnly(true);
connect(m_asmEditor, &AsmEditorWidget::gotFocus, this, &CompilerWidget::gotFocus); connect(m_asmEditor, &AsmEditorWidget::gotFocus, this, &CompilerWidget::gotFocus);

View File

@@ -13,8 +13,7 @@
namespace TextEditor { namespace TextEditor {
class TextDocument; class TextDocument;
class TEXTEDITOR_EXPORT Highlighter : public SyntaxHighlighter, class Highlighter : public SyntaxHighlighter, public KSyntaxHighlighting::AbstractHighlighter
public KSyntaxHighlighting::AbstractHighlighter
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(KSyntaxHighlighting::AbstractHighlighter) Q_INTERFACES(KSyntaxHighlighting::AbstractHighlighter)

View File

@@ -9068,10 +9068,15 @@ void TextEditorWidget::configureGenericHighlighter(const Utils::MimeType &mimeTy
d->removeSyntaxInfoBar(); d->removeSyntaxInfoBar();
} }
void TextEditorWidget::configureGenericHighlighter(const Highlighter::Definition &definition) expected_str<void> TextEditorWidget::configureGenericHighlighter(const QString &definitionName)
{ {
Highlighter::Definition definition = TextEditor::Highlighter::definitionForName(definitionName);
if (!definition.isValid())
return make_unexpected(Tr::tr("Could not find definition"));
d->configureGenericHighlighter(definition); d->configureGenericHighlighter(definition);
d->removeSyntaxInfoBar(); d->removeSyntaxInfoBar();
return {};
} }
int TextEditorWidget::blockNumberForVisibleRow(int row) const int TextEditorWidget::blockNumberForVisibleRow(int row) const

View File

@@ -6,7 +6,6 @@
#include "texteditor_global.h" #include "texteditor_global.h"
#include "codeassist/assistenums.h" #include "codeassist/assistenums.h"
#include "highlighter.h"
#include "indenter.h" #include "indenter.h"
#include "refactoroverlay.h" #include "refactoroverlay.h"
#include "snippets/snippetparser.h" #include "snippets/snippetparser.h"
@@ -455,7 +454,7 @@ public:
void configureGenericHighlighter(const Utils::MimeType &mimeType); void configureGenericHighlighter(const Utils::MimeType &mimeType);
/// Overwrite the current highlighter with a new generic highlighter based on the given definition /// Overwrite the current highlighter with a new generic highlighter based on the given definition
void configureGenericHighlighter(const Highlighter::Definition &definition); Utils::expected_str<void> configureGenericHighlighter(const QString &definitionName);
Q_INVOKABLE void inSnippetMode(bool *active); // Used by FakeVim. Q_INVOKABLE void inSnippetMode(bool *active); // Used by FakeVim.