Editor: use forked plaintextedit

Change-Id: I43f3b356d24d4e45e80ed9d25768f9eb805b436e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2025-02-26 13:01:29 +01:00
parent f98cdcb8f0
commit dd9681b0e9
20 changed files with 93 additions and 92 deletions

View File

@@ -474,7 +474,7 @@ void CppEditorWidget::finalizeInitialization()
}); });
connect(&d->m_localRenaming, &CppLocalRenaming::processKeyPressNormally, connect(&d->m_localRenaming, &CppLocalRenaming::processKeyPressNormally,
this, &CppEditorWidget::processKeyNormally); this, &CppEditorWidget::processKeyNormally);
connect(this, &QPlainTextEdit::cursorPositionChanged, this, [this] { connect(this, &PlainTextEdit::cursorPositionChanged, this, [this] {
if (d->m_cppEditorOutline) if (d->m_cppEditorOutline)
d->m_cppEditorOutline->updateIndex(); d->m_cppEditorOutline->updateIndex();
}); });
@@ -489,8 +489,8 @@ void CppEditorWidget::finalizeInitialization()
d->m_updateFunctionDeclDefLinkTimer.setInterval(UPDATE_FUNCTION_DECL_DEF_LINK_INTERVAL); d->m_updateFunctionDeclDefLinkTimer.setInterval(UPDATE_FUNCTION_DECL_DEF_LINK_INTERVAL);
connect(&d->m_updateFunctionDeclDefLinkTimer, &QTimer::timeout, connect(&d->m_updateFunctionDeclDefLinkTimer, &QTimer::timeout,
this, &CppEditorWidget::updateFunctionDeclDefLinkNow); this, &CppEditorWidget::updateFunctionDeclDefLinkNow);
connect(this, &QPlainTextEdit::cursorPositionChanged, this, &CppEditorWidget::updateFunctionDeclDefLink); connect(this, &PlainTextEdit::cursorPositionChanged, this, &CppEditorWidget::updateFunctionDeclDefLink);
connect(this, &QPlainTextEdit::textChanged, this, &CppEditorWidget::updateFunctionDeclDefLink); connect(this, &PlainTextEdit::textChanged, this, &CppEditorWidget::updateFunctionDeclDefLink);
// set up the use highlighitng // set up the use highlighitng
connect(this, &CppEditorWidget::cursorPositionChanged, this, [this] { connect(this, &CppEditorWidget::cursorPositionChanged, this, [this] {

View File

@@ -147,7 +147,7 @@ CppOutlineWidget::CppOutlineWidget(CppEditorWidget *editor) :
connect(m_treeView, &QAbstractItemView::activated, connect(m_treeView, &QAbstractItemView::activated,
this, &CppOutlineWidget::onItemActivated); this, &CppOutlineWidget::onItemActivated);
connect(editor, &QPlainTextEdit::cursorPositionChanged, this, [this] { connect(editor, &Utils::PlainTextEdit::cursorPositionChanged, this, [this] {
if (m_model->rootItem()->hasChildren()) if (m_model->rootItem()->hasChildren())
updateIndex(); updateIndex();
}); });

View File

@@ -97,7 +97,7 @@ void SourceAgent::setContent(const QString &filePath, const QString &content)
EditorManager::activateEditor(d->editor); EditorManager::activateEditor(d->editor);
} }
QPlainTextEdit *plainTextEdit = d->editor->editorWidget(); Utils::PlainTextEdit *plainTextEdit = d->editor->editorWidget();
QTC_ASSERT(plainTextEdit, return); QTC_ASSERT(plainTextEdit, return);
plainTextEdit->setReadOnly(true); plainTextEdit->setReadOnly(true);

View File

@@ -710,7 +710,7 @@ SideBySideDiffEditorWidget::SideBySideDiffEditorWidget(QWidget *parent)
connect(m_editor[side]->horizontalScrollBar(), &QAbstractSlider::actionTriggered, connect(m_editor[side]->horizontalScrollBar(), &QAbstractSlider::actionTriggered,
this, std::bind(&SideBySideDiffEditorWidget::horizontalSliderChanged, this, side)); this, std::bind(&SideBySideDiffEditorWidget::horizontalSliderChanged, this, side));
connect(m_editor[side], &QPlainTextEdit::cursorPositionChanged, connect(m_editor[side], &PlainTextEdit::cursorPositionChanged,
this, std::bind(&SideBySideDiffEditorWidget::cursorPositionChanged, this, side)); this, std::bind(&SideBySideDiffEditorWidget::cursorPositionChanged, this, side));
connect(m_editor[side]->horizontalScrollBar(), &QAbstractSlider::rangeChanged, connect(m_editor[side]->horizontalScrollBar(), &QAbstractSlider::rangeChanged,

View File

@@ -40,7 +40,7 @@ UnifiedDiffEditorWidget::UnifiedDiffEditorWidget(QWidget *parent)
clear(Tr::tr("No document")); clear(Tr::tr("No document"));
connect(this, &QPlainTextEdit::cursorPositionChanged, connect(this, &PlainTextEdit::cursorPositionChanged,
this, &UnifiedDiffEditorWidget::slotCursorPositionChangedInEditor); this, &UnifiedDiffEditorWidget::slotCursorPositionChangedInEditor);
IContext::attach(this, Context(Constants::UNIFIED_VIEW_ID)); IContext::attach(this, Context(Constants::UNIFIED_VIEW_ID));

View File

@@ -226,7 +226,7 @@ public:
this, &RelativeNumbersColumn::followEditorLayout); this, &RelativeNumbersColumn::followEditorLayout);
auto start = QOverload<>::of(&QTimer::start); auto start = QOverload<>::of(&QTimer::start);
connect(m_editor, &QPlainTextEdit::cursorPositionChanged, connect(m_editor, &PlainTextEdit::cursorPositionChanged,
&m_timerUpdate, start); &m_timerUpdate, start);
connect(m_editor->verticalScrollBar(), &QAbstractSlider::valueChanged, connect(m_editor->verticalScrollBar(), &QAbstractSlider::valueChanged,
&m_timerUpdate, start); &m_timerUpdate, start);

View File

@@ -252,7 +252,7 @@ void InstantBlame::setup()
} }
qCInfo(log) << "Adding blame cursor connection"; qCInfo(log) << "Adding blame cursor connection";
m_blameCursorPosConn = connect(widget, &QPlainTextEdit::cursorPositionChanged, this, m_blameCursorPosConn = connect(widget, &PlainTextEdit::cursorPositionChanged, this,
[this] { [this] {
if (!settings().instantBlame()) { if (!settings().instantBlame()) {
disconnect(m_blameCursorPosConn); disconnect(m_blameCursorPosConn);
@@ -354,7 +354,7 @@ void InstantBlame::once()
connect(EditorManager::instance(), &EditorManager::currentEditorChanged, connect(EditorManager::instance(), &EditorManager::currentEditorChanged,
this, [this] { m_blameMark.reset(); }, Qt::SingleShotConnection); this, [this] { m_blameMark.reset(); }, Qt::SingleShotConnection);
connect(widget, &QPlainTextEdit::cursorPositionChanged, connect(widget, &PlainTextEdit::cursorPositionChanged,
this, [this] { m_blameMark.reset(); }, Qt::SingleShotConnection); this, [this] { m_blameMark.reset(); }, Qt::SingleShotConnection);
const FilePath workingDirectory = currentState().topLevel(); const FilePath workingDirectory = currentState().topLevel();

View File

@@ -252,7 +252,7 @@ GlslEditorWidget::GlslEditorWidget()
connect(&m_updateDocumentTimer, &QTimer::timeout, connect(&m_updateDocumentTimer, &QTimer::timeout,
this, &GlslEditorWidget::updateDocumentNow); this, &GlslEditorWidget::updateDocumentNow);
connect(this, &QPlainTextEdit::textChanged, [this] { m_updateDocumentTimer.start(); }); connect(this, &PlainTextEdit::textChanged, [this] { m_updateDocumentTimer.start(); });
m_outlineCombo = new QComboBox; m_outlineCombo = new QComboBox;
m_outlineCombo->setMinimumContentsLength(22); m_outlineCombo->setMinimumContentsLength(22);

View File

@@ -34,7 +34,7 @@ AbstractEditorDialog::AbstractEditorDialog(QWidget *parent, const QString &title
this, &AbstractEditorDialog::rejected); this, &AbstractEditorDialog::rejected);
QObject::connect(m_editorWidget, &BindingEditorWidget::returnKeyClicked, QObject::connect(m_editorWidget, &BindingEditorWidget::returnKeyClicked,
this, &AbstractEditorDialog::accepted); this, &AbstractEditorDialog::accepted);
QObject::connect(m_editorWidget, &QPlainTextEdit::textChanged, QObject::connect(m_editorWidget, &Utils::PlainTextEdit::textChanged,
this, &AbstractEditorDialog::textChanged); this, &AbstractEditorDialog::textChanged);
} }

View File

@@ -69,7 +69,7 @@ void TextEditorWidget::setTextEditor(
setFocusProxy(m_textEditor->editorWidget()); setFocusProxy(m_textEditor->editorWidget());
connect(m_textEditor->editorWidget(), &QPlainTextEdit::cursorPositionChanged, this, [this] { connect(m_textEditor->editorWidget(), &Utils::PlainTextEdit::cursorPositionChanged, this, [this] {
// Cursor position is changed by rewriter // Cursor position is changed by rewriter
if (!m_blockCursorSelectionSynchronisation) if (!m_blockCursorSelectionSynchronisation)
m_updateSelectionTimer.start(); m_updateSelectionTimer.start();

View File

@@ -133,7 +133,7 @@ void QmlJSEditorWidget::finalizeInitialization()
m_updateUsesTimer.setInterval(UPDATE_USES_DEFAULT_INTERVAL); m_updateUsesTimer.setInterval(UPDATE_USES_DEFAULT_INTERVAL);
m_updateUsesTimer.setSingleShot(true); m_updateUsesTimer.setSingleShot(true);
connect(&m_updateUsesTimer, &QTimer::timeout, this, &QmlJSEditorWidget::updateUses); connect(&m_updateUsesTimer, &QTimer::timeout, this, &QmlJSEditorWidget::updateUses);
connect(this, &QPlainTextEdit::cursorPositionChanged, connect(this, &PlainTextEdit::cursorPositionChanged,
&m_updateUsesTimer, QOverload<>::of(&QTimer::start)); &m_updateUsesTimer, QOverload<>::of(&QTimer::start));
m_updateOutlineIndexTimer.setInterval(UPDATE_OUTLINE_INTERVAL); m_updateOutlineIndexTimer.setInterval(UPDATE_OUTLINE_INTERVAL);

View File

@@ -136,7 +136,7 @@ static FormatOutput format(const FormatInput &input)
* actually changed parts are updated while preserving the cursor position, the folded * actually changed parts are updated while preserving the cursor position, the folded
* blocks, and the scroll bar position. * blocks, and the scroll bar position.
*/ */
void updateEditorText(QPlainTextEdit *editor, const QString &text) void updateEditorText(PlainTextEdit *editor, const QString &text)
{ {
const QString editorText = editor->toPlainText(); const QString editorText = editor->toPlainText();
if (editorText == text) if (editorText == text)
@@ -260,7 +260,7 @@ static void showError(const QString &error)
* Checks the state of @a task and if the formatting was successful calls updateEditorText() with * Checks the state of @a task and if the formatting was successful calls updateEditorText() with
* the respective members of @a task. * the respective members of @a task.
*/ */
static void checkAndApplyTask(const QPointer<QPlainTextEdit> &textEditor, const FormatInput &input, static void checkAndApplyTask(const QPointer<PlainTextEdit> &textEditor, const FormatInput &input,
const FormatOutput &output) const FormatOutput &output)
{ {
if (!output.has_value()) { if (!output.has_value()) {
@@ -318,7 +318,7 @@ void formatEditorAsync(TextEditorWidget *editor, const Command &command, int sta
QObject::connect(doc, &TextDocument::contentsChanged, watcher, QObject::connect(doc, &TextDocument::contentsChanged, watcher,
&QFutureWatcher<FormatOutput>::cancel); &QFutureWatcher<FormatOutput>::cancel);
QObject::connect(watcher, &QFutureWatcherBase::finished, watcher, QObject::connect(watcher, &QFutureWatcherBase::finished, watcher,
[watcher, editor = QPointer<QPlainTextEdit>(editor), input] { [watcher, editor = QPointer<PlainTextEdit>(editor), input] {
if (watcher->isCanceled()) if (watcher->isCanceled())
showError(Tr::tr("File was modified.")); showError(Tr::tr("File was modified."));
else else

View File

@@ -9,7 +9,7 @@
#include <utils/filepath.h> #include <utils/filepath.h>
#include <QPlainTextEdit> namespace Utils { class PlainTextEdit; }
namespace TextEditor { namespace TextEditor {
@@ -20,6 +20,6 @@ TEXTEDITOR_EXPORT void formatEditor(TextEditorWidget *editor, const TextEditor::
int startPos = -1, int endPos = 0); int startPos = -1, int endPos = 0);
TEXTEDITOR_EXPORT void formatEditorAsync(TextEditorWidget *editor, const TextEditor::Command &command, TEXTEDITOR_EXPORT void formatEditorAsync(TextEditorWidget *editor, const TextEditor::Command &command,
int startPos = -1, int endPos = 0); int startPos = -1, int endPos = 0);
TEXTEDITOR_EXPORT void updateEditorText(QPlainTextEdit *editor, const QString &text); TEXTEDITOR_EXPORT void updateEditorText(Utils::PlainTextEdit *editor, const QString &text);
} // namespace TextEditor } // namespace TextEditor

View File

@@ -41,7 +41,7 @@ void SnippetEditorWidget::focusOutEvent(QFocusEvent *event)
void SnippetEditorWidget::contextMenuEvent(QContextMenuEvent *e) void SnippetEditorWidget::contextMenuEvent(QContextMenuEvent *e)
{ {
QPlainTextEdit::contextMenuEvent(e); PlainTextEdit::contextMenuEvent(e);
} }
} // namespace } // namespace

View File

@@ -1080,7 +1080,7 @@ void TextDocument::removeMarkFromMarksCache(TextMark *mark)
auto scheduleLayoutUpdate = [documentLayout](){ auto scheduleLayoutUpdate = [documentLayout](){
// make sure all destructors that may directly or indirectly call this function are // make sure all destructors that may directly or indirectly call this function are
// completed before updating. // completed before updating.
QMetaObject::invokeMethod(documentLayout, &QPlainTextDocumentLayout::requestUpdate, QMetaObject::invokeMethod(documentLayout, &PlainTextDocumentLayout::requestUpdate,
Qt::QueuedConnection); Qt::QueuedConnection);
}; };

View File

@@ -348,7 +348,7 @@ void TextBlockUserData::addMark(TextMark *mark)
} }
TextDocumentLayout::TextDocumentLayout(QTextDocument *doc) TextDocumentLayout::TextDocumentLayout(QTextDocument *doc)
: QPlainTextDocumentLayout(doc) : PlainTextDocumentLayout(doc)
{} {}
TextDocumentLayout::~TextDocumentLayout() TextDocumentLayout::~TextDocumentLayout()
@@ -721,7 +721,7 @@ void TextDocumentLayout::setRequiredWidth(int width)
{ {
int oldw = m_requiredWidth; int oldw = m_requiredWidth;
m_requiredWidth = width; m_requiredWidth = width;
int dw = int(QPlainTextDocumentLayout::documentSize().width()); int dw = int(PlainTextDocumentLayout::documentSize().width());
if (oldw > dw || width > dw) if (oldw > dw || width > dw)
emitDocumentSizeChanged(); emitDocumentSizeChanged();
} }
@@ -729,7 +729,7 @@ void TextDocumentLayout::setRequiredWidth(int width)
QSizeF TextDocumentLayout::documentSize() const QSizeF TextDocumentLayout::documentSize() const
{ {
QSizeF size = QPlainTextDocumentLayout::documentSize(); QSizeF size = PlainTextDocumentLayout::documentSize();
size.setWidth(qMax(qreal(m_requiredWidth), size.width())); size.setWidth(qMax(qreal(m_requiredWidth), size.width()));
return size; return size;
} }
@@ -818,7 +818,7 @@ void TextDocumentLayout::requestUpdateNow()
int TextDocumentLayout::embeddedWidgetOffset(const QTextBlock &block, QWidget *widget) int TextDocumentLayout::embeddedWidgetOffset(const QTextBlock &block, QWidget *widget)
{ {
if (auto userData = TextBlockUserData::textUserData(block)) { if (auto userData = TextBlockUserData::textUserData(block)) {
int offset = QPlainTextDocumentLayout::blockBoundingRect(block).height(); int offset = PlainTextDocumentLayout::blockBoundingRect(block).height();
for (auto embeddedWidget : userData->embeddedWidgets(block)) { for (auto embeddedWidget : userData->embeddedWidgets(block)) {
if (embeddedWidget == widget) if (embeddedWidget == widget)
return offset; return offset;
@@ -838,7 +838,7 @@ void TextDocumentLayout::resetReloadMarks()
static QRectF replacementBoundingRect(const QTextDocument *replacement) static QRectF replacementBoundingRect(const QTextDocument *replacement)
{ {
QTC_ASSERT(replacement, return {}); QTC_ASSERT(replacement, return {});
auto *layout = static_cast<QPlainTextDocumentLayout *>(replacement->documentLayout()); auto *layout = static_cast<Utils::PlainTextDocumentLayout *>(replacement->documentLayout());
QRectF boundingRect; QRectF boundingRect;
QTextBlock block = replacement->firstBlock(); QTextBlock block = replacement->firstBlock();
while (block.isValid()) { while (block.isValid()) {
@@ -859,7 +859,7 @@ QRectF TextDocumentLayout::blockBoundingRect(const QTextBlock &block) const
return replacementBoundingRect(suggestion->replacementDocument()); return replacementBoundingRect(suggestion->replacementDocument());
} }
QRectF boundingRect = QPlainTextDocumentLayout::blockBoundingRect(block); QRectF boundingRect = PlainTextDocumentLayout::blockBoundingRect(block);
if (TextEditorSettings::fontSettings().relativeLineSpacing() != 100) { if (TextEditorSettings::fontSettings().relativeLineSpacing() != 100) {
if (boundingRect.isNull()) if (boundingRect.isNull())

View File

@@ -10,6 +10,7 @@
#include "textsuggestion.h" #include "textsuggestion.h"
#include <utils/id.h> #include <utils/id.h>
#include <utils/plaintextedit/plaintextedit.h>
#include <KSyntaxHighlighting/State> #include <KSyntaxHighlighting/State>
@@ -158,7 +159,7 @@ private:
quint8 m_attrState = 0; quint8 m_attrState = 0;
}; };
class TEXTEDITOR_EXPORT TextDocumentLayout : public QPlainTextDocumentLayout class TEXTEDITOR_EXPORT TextDocumentLayout : public Utils::PlainTextDocumentLayout
{ {
Q_OBJECT Q_OBJECT

View File

@@ -126,7 +126,7 @@
/*! /*!
\class TextEditor::BaseTextEditor \class TextEditor::BaseTextEditor
\brief The BaseTextEditor class is base implementation for QPlainTextEdit-based \brief The BaseTextEditor class is base implementation for PlainTextEdit-based
text editors. It can use the Kate text highlighting definitions, and some basic text editors. It can use the Kate text highlighting definitions, and some basic
auto indentation. auto indentation.
@@ -169,7 +169,7 @@ LineColumnButton::LineColumnButton(TextEditorWidget *parent)
, m_d(new LineColumnButtonPrivate) , m_d(new LineColumnButtonPrivate)
{ {
m_d->m_editor = parent; m_d->m_editor = parent;
connect(m_d->m_editor, &QPlainTextEdit::cursorPositionChanged, this, &LineColumnButton::update); connect(m_d->m_editor, &PlainTextEdit::cursorPositionChanged, this, &LineColumnButton::update);
connect(this, &QToolButton::clicked, ActionManager::instance(), [this] { connect(this, &QToolButton::clicked, ActionManager::instance(), [this] {
m_d->m_editor->setFocus(); m_d->m_editor->setFocus();
QMetaObject::invokeMethod( QMetaObject::invokeMethod(
@@ -1253,30 +1253,30 @@ TextEditorWidgetPrivate::TextEditorWidgetPrivate(TextEditorWidget *parent)
connect(&m_codeAssistant, &CodeAssistant::finished, connect(&m_codeAssistant, &CodeAssistant::finished,
q, &TextEditorWidget::assistFinished); q, &TextEditorWidget::assistFinished);
connect(q, &QPlainTextEdit::blockCountChanged, this, [this] { slotUpdateExtraAreaWidth(); }); connect(q, &PlainTextEdit::blockCountChanged, this, [this] { slotUpdateExtraAreaWidth(); });
connect(q, &QPlainTextEdit::modificationChanged, connect(q, &PlainTextEdit::modificationChanged,
m_extraArea, QOverload<>::of(&QWidget::update)); m_extraArea, QOverload<>::of(&QWidget::update));
connect(q, &QPlainTextEdit::cursorPositionChanged, connect(q, &PlainTextEdit::cursorPositionChanged,
q, &TextEditorWidget::slotCursorPositionChanged); q, &TextEditorWidget::slotCursorPositionChanged);
connect(q, &QPlainTextEdit::cursorPositionChanged, connect(q, &PlainTextEdit::cursorPositionChanged,
this, &TextEditorWidgetPrivate::updateCursorPosition); this, &TextEditorWidgetPrivate::updateCursorPosition);
connect(q, &QPlainTextEdit::updateRequest, connect(q, &PlainTextEdit::updateRequest,
this, &TextEditorWidgetPrivate::slotUpdateRequest); this, &TextEditorWidgetPrivate::slotUpdateRequest);
connect(q, &QPlainTextEdit::selectionChanged, connect(q, &PlainTextEdit::selectionChanged,
this, &TextEditorWidgetPrivate::slotSelectionChanged); this, &TextEditorWidgetPrivate::slotSelectionChanged);
connect(q, &QPlainTextEdit::undoAvailable, connect(q, &PlainTextEdit::undoAvailable,
this, &TextEditorWidgetPrivate::updateUndoAction); this, &TextEditorWidgetPrivate::updateUndoAction);
connect(q, &QPlainTextEdit::redoAvailable, connect(q, &PlainTextEdit::redoAvailable,
this, &TextEditorWidgetPrivate::updateRedoAction); this, &TextEditorWidgetPrivate::updateRedoAction);
connect(q, &QPlainTextEdit::copyAvailable, connect(q, &PlainTextEdit::copyAvailable,
this, &TextEditorWidgetPrivate::updateCopyAction); this, &TextEditorWidgetPrivate::updateCopyAction);
m_parenthesesMatchingTimer.setSingleShot(true); m_parenthesesMatchingTimer.setSingleShot(true);
@@ -1450,7 +1450,7 @@ Id TextEditorWidget::DebuggerExceptionSelection("TextEdit.DebuggerExceptionSelec
Id TextEditorWidget::FakeVimSelection("TextEdit.FakeVimSelection"); Id TextEditorWidget::FakeVimSelection("TextEdit.FakeVimSelection");
TextEditorWidget::TextEditorWidget(QWidget *parent) TextEditorWidget::TextEditorWidget(QWidget *parent)
: QPlainTextEdit(parent) : PlainTextEdit(parent)
{ {
// "Needed", as the creation below triggers ChildEvents that are // "Needed", as the creation below triggers ChildEvents that are
// passed to this object's event() which uses 'd'. // passed to this object's event() which uses 'd'.
@@ -1491,7 +1491,7 @@ void TextEditorWidgetPrivate::setDocument(const QSharedPointer<TextDocument> &do
m_documentConnections.clear(); m_documentConnections.clear();
m_document = doc; m_document = doc;
q->QPlainTextEdit::setDocument(doc->document()); q->PlainTextEdit::setDocument(doc->document());
m_tabSettingsButton->setDocument(q->textDocument()); m_tabSettingsButton->setDocument(q->textDocument());
previousDocument.clear(); previousDocument.clear();
q->setCursorWidth(2); // Applies to the document layout q->setCursorWidth(2); // Applies to the document layout
@@ -1501,7 +1501,7 @@ void TextEditorWidgetPrivate::setDocument(const QSharedPointer<TextDocument> &do
QTC_CHECK(documentLayout); QTC_CHECK(documentLayout);
m_documentConnections << connect(documentLayout, m_documentConnections << connect(documentLayout,
&QPlainTextDocumentLayout::updateBlock, &TextDocumentLayout::updateBlock,
this, this,
&TextEditorWidgetPrivate::slotUpdateBlockNotify); &TextEditorWidgetPrivate::slotUpdateBlockNotify);
@@ -1513,7 +1513,7 @@ void TextEditorWidgetPrivate::setDocument(const QSharedPointer<TextDocument> &do
m_documentConnections << connect(q, m_documentConnections << connect(q,
&TextEditorWidget::requestBlockUpdate, &TextEditorWidget::requestBlockUpdate,
documentLayout, documentLayout,
&QPlainTextDocumentLayout::updateBlock); &TextDocumentLayout::updateBlock);
m_documentConnections << connect(documentLayout, m_documentConnections << connect(documentLayout,
&TextDocumentLayout::updateExtraArea, &TextDocumentLayout::updateExtraArea,
@@ -2734,13 +2734,13 @@ void TextEditorWidget::unindent()
void TextEditorWidget::undo() void TextEditorWidget::undo()
{ {
doSetTextCursor(multiTextCursor().mainCursor()); doSetTextCursor(multiTextCursor().mainCursor());
QPlainTextEdit::undo(); PlainTextEdit::undo();
} }
void TextEditorWidget::redo() void TextEditorWidget::redo()
{ {
doSetTextCursor(multiTextCursor().mainCursor()); doSetTextCursor(multiTextCursor().mainCursor());
QPlainTextEdit::redo(); PlainTextEdit::redo();
} }
bool TextEditorWidget::isUndoAvailable() const bool TextEditorWidget::isUndoAvailable() const
@@ -3271,7 +3271,7 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e)
if (cursorWithinSnippet) if (cursorWithinSnippet)
cursor.beginEditBlock(); cursor.beginEditBlock();
QPlainTextEdit::keyPressEvent(e); PlainTextEdit::keyPressEvent(e);
if (cursorWithinSnippet) { if (cursorWithinSnippet) {
cursor.endEditBlock(); cursor.endEditBlock();
@@ -3473,7 +3473,7 @@ void TextEditorWidget::doSetTextCursor(const QTextCursor &cursor, bool keepMulti
const_cast<MultiTextCursor &>(d->m_cursors).replaceMainCursor(c); const_cast<MultiTextCursor &>(d->m_cursors).replaceMainCursor(c);
d->updateCursorSelections(); d->updateCursorSelections();
d->resetCursorFlashTimer(); d->resetCursorFlashTimer();
QPlainTextEdit::doSetTextCursor(c); PlainTextEdit::doSetTextCursor(c);
if (oldCursor != d->m_cursors) { if (oldCursor != d->m_cursors) {
QRect updateRect = d->cursorUpdateRect(oldCursor); QRect updateRect = d->cursorUpdateRect(oldCursor);
if (d->m_highlightCurrentLine) if (d->m_highlightCurrentLine)
@@ -3624,7 +3624,7 @@ void TextEditorWidget::convertPosition(int pos, int *line, int *column) const
bool TextEditorWidget::event(QEvent *e) bool TextEditorWidget::event(QEvent *e)
{ {
if (!d) if (!d)
return QPlainTextEdit::event(e); return PlainTextEdit::event(e);
// FIXME: That's far too heavy, and triggers e.g for ChildEvent // FIXME: That's far too heavy, and triggers e.g for ChildEvent
if (e->type() != QEvent::InputMethodQuery) if (e->type() != QEvent::InputMethodQuery)
@@ -3668,7 +3668,7 @@ bool TextEditorWidget::event(QEvent *e)
break; break;
} }
return QPlainTextEdit::event(e); return PlainTextEdit::event(e);
} }
void TextEditorWidget::contextMenuEvent(QContextMenuEvent *e) void TextEditorWidget::contextMenuEvent(QContextMenuEvent *e)
@@ -3685,7 +3685,7 @@ void TextEditorWidgetPrivate::documentAboutToBeReloaded()
m_extraSelections.clear(); m_extraSelections.clear();
m_extraSelections.reserve(NExtraSelectionKinds); m_extraSelections.reserve(NExtraSelectionKinds);
q->QPlainTextEdit::setExtraSelections(QList<QTextEdit::ExtraSelection>()); q->PlainTextEdit::setExtraSelections(QList<QTextEdit::ExtraSelection>());
// clear all overlays // clear all overlays
m_overlay->clear(); m_overlay->clear();
@@ -4125,7 +4125,7 @@ void EmbeddedWidgetInterface::close()
void TextEditorWidgetPrivate::forceUpdateScrollbarSize() void TextEditorWidgetPrivate::forceUpdateScrollbarSize()
{ {
// We use resizeEvent here as a workaround as we can't get access to the // We use resizeEvent here as a workaround as we can't get access to the
// scrollarea which is a private part of the QPlainTextEdit. // scrollarea which is a private part of the PlainTextEdit.
// During the resizeEvent the plain text edit will resize its scrollbars. // During the resizeEvent the plain text edit will resize its scrollbars.
// The TextEditorWidget will also update its scrollbar overlays. // The TextEditorWidget will also update its scrollbar overlays.
QResizeEvent event(q->size(), q->size()); QResizeEvent event(q->size(), q->size());
@@ -4985,13 +4985,13 @@ bool TextEditorWidget::viewportEvent(QEvent *event)
ToolTip::hide(); ToolTip::hide();
} }
} }
return QPlainTextEdit::viewportEvent(event); return PlainTextEdit::viewportEvent(event);
} }
void TextEditorWidget::resizeEvent(QResizeEvent *e) void TextEditorWidget::resizeEvent(QResizeEvent *e)
{ {
QPlainTextEdit::resizeEvent(e); PlainTextEdit::resizeEvent(e);
QRect cr = rect(); QRect cr = rect();
d->m_extraArea->setGeometry( d->m_extraArea->setGeometry(
QStyle::visualRect(layoutDirection(), cr, QStyle::visualRect(layoutDirection(), cr,
@@ -5952,7 +5952,7 @@ void TextEditorWidgetPrivate::paintIndentDepth(PaintEventData &data,
while (paintColumn < depth) { while (paintColumn < depth) {
if (x >= 0) { if (x >= 0) {
int paintPosition = data.tabSettings.positionAtColumn(text, paintColumn); int paintPosition = data.tabSettings.positionAtColumn(text, paintColumn);
if (q->lineWrapMode() == QPlainTextEdit::WidgetWidth if (q->lineWrapMode() == PlainTextEdit::WidgetWidth
&& blockData.layout->lineForTextPosition(paintPosition).lineNumber() != 0) { && blockData.layout->lineForTextPosition(paintPosition).lineNumber() != 0) {
break; break;
} }
@@ -7060,7 +7060,7 @@ void TextEditorWidget::timerEvent(QTimerEvent *e)
d->m_cursorVisible = !d->m_cursorVisible; d->m_cursorVisible = !d->m_cursorVisible;
viewport()->update(d->cursorUpdateRect(d->m_cursors)); viewport()->update(d->cursorUpdateRect(d->m_cursors));
} }
QPlainTextEdit::timerEvent(e); PlainTextEdit::timerEvent(e);
} }
@@ -7152,7 +7152,7 @@ void TextEditorWidget::mouseMoveEvent(QMouseEvent *e)
} }
} else if (!onLink || e->buttons() != Qt::LeftButton } else if (!onLink || e->buttons() != Qt::LeftButton
|| e->modifiers() != Qt::ControlModifier) { || e->modifiers() != Qt::ControlModifier) {
QPlainTextEdit::mouseMoveEvent(e); PlainTextEdit::mouseMoveEvent(e);
} }
} }
@@ -7236,7 +7236,7 @@ void TextEditorWidget::mousePressEvent(QMouseEvent *e)
if (HostOsInfo::isLinuxHost() && handleForwardBackwardMouseButtons(e)) if (HostOsInfo::isLinuxHost() && handleForwardBackwardMouseButtons(e))
return; return;
QPlainTextEdit::mousePressEvent(e); PlainTextEdit::mousePressEvent(e);
} }
void TextEditorWidget::mouseReleaseEvent(QMouseEvent *e) void TextEditorWidget::mouseReleaseEvent(QMouseEvent *e)
@@ -7273,7 +7273,7 @@ void TextEditorWidget::mouseReleaseEvent(QMouseEvent *e)
} }
} }
QPlainTextEdit::mouseReleaseEvent(e); PlainTextEdit::mouseReleaseEvent(e);
d->setClipboardSelection(); d->setClipboardSelection();
const QTextCursor plainTextEditCursor = textCursor(); const QTextCursor plainTextEditCursor = textCursor();
@@ -7298,9 +7298,9 @@ void TextEditorWidget::mouseDoubleClickEvent(QMouseEvent *e)
QTextCursor eventCursor = cursorForPosition(QPoint(e->pos().x(), e->pos().y())); QTextCursor eventCursor = cursorForPosition(QPoint(e->pos().x(), e->pos().y()));
const int eventDocumentPosition = eventCursor.position(); const int eventDocumentPosition = eventCursor.position();
QPlainTextEdit::mouseDoubleClickEvent(e); PlainTextEdit::mouseDoubleClickEvent(e);
// QPlainTextEdit::mouseDoubleClickEvent just selects the word under the text cursor. If the // PlainTextEdit::mouseDoubleClickEvent just selects the word under the text cursor. If the
// event is triggered on a position that is inbetween two whitespaces this event selects the // event is triggered on a position that is inbetween two whitespaces this event selects the
// previous word or nothing if the whitespaces are at the block start. Replace this behavior // previous word or nothing if the whitespaces are at the block start. Replace this behavior
// with selecting the whitespaces starting from the previous word end to the next word. // with selecting the whitespaces starting from the previous word end to the next word.
@@ -7332,7 +7332,7 @@ void TextEditorWidget::leaveEvent(QEvent *e)
{ {
// Clear link emulation when the mouse leaves the editor // Clear link emulation when the mouse leaves the editor
d->clearLink(); d->clearLink();
QPlainTextEdit::leaveEvent(e); PlainTextEdit::leaveEvent(e);
} }
void TextEditorWidget::keyReleaseEvent(QKeyEvent *e) void TextEditorWidget::keyReleaseEvent(QKeyEvent *e)
@@ -7347,7 +7347,7 @@ void TextEditorWidget::keyReleaseEvent(QKeyEvent *e)
d->processTooltipRequest(textCursor()); d->processTooltipRequest(textCursor());
} }
QPlainTextEdit::keyReleaseEvent(e); PlainTextEdit::keyReleaseEvent(e);
} }
void TextEditorWidget::dragEnterEvent(QDragEnterEvent *e) void TextEditorWidget::dragEnterEvent(QDragEnterEvent *e)
@@ -7358,7 +7358,7 @@ void TextEditorWidget::dragEnterEvent(QDragEnterEvent *e)
return; return;
} }
QPlainTextEdit::dragEnterEvent(e); PlainTextEdit::dragEnterEvent(e);
} }
static void appendMenuActionsFromContext(QMenu *menu, Id menuContextId) static void appendMenuActionsFromContext(QMenu *menu, Id menuContextId)
@@ -7704,7 +7704,7 @@ void TextEditorWidget::extraAreaMouseEvent(QMouseEvent *e)
void TextEditorWidget::ensureCursorVisible() void TextEditorWidget::ensureCursorVisible()
{ {
ensureBlockIsUnfolded(textCursor().block()); ensureBlockIsUnfolded(textCursor().block());
QPlainTextEdit::ensureCursorVisible(); PlainTextEdit::ensureCursorVisible();
} }
void TextEditorWidget::ensureBlockIsUnfolded(QTextBlock block) void TextEditorWidget::ensureBlockIsUnfolded(QTextBlock block)
@@ -7932,7 +7932,7 @@ void TextEditorWidget::wheelEvent(QWheelEvent *e)
if (e->modifiers() & Qt::ControlModifier) { if (e->modifiers() & Qt::ControlModifier) {
if (!scrollWheelZoomingEnabled()) { if (!scrollWheelZoomingEnabled()) {
// When the setting is disabled globally, // When the setting is disabled globally,
// we have to skip calling QPlainTextEdit::wheelEvent() // we have to skip calling PlainTextEdit::wheelEvent()
// that changes zoom in it. // that changes zoom in it.
return; return;
} }
@@ -7942,7 +7942,7 @@ void TextEditorWidget::wheelEvent(QWheelEvent *e)
zoomF(deltaY / 120.f); zoomF(deltaY / 120.f);
return; return;
} }
QPlainTextEdit::wheelEvent(e); PlainTextEdit::wheelEvent(e);
} }
static void showZoomIndicator(QWidget *editor, const int newZoom) static void showZoomIndicator(QWidget *editor, const int newZoom)
@@ -8221,7 +8221,7 @@ void TextEditorWidgetPrivate::addSearchResultsToScrollBar(
for (const SearchResult &result : results) { for (const SearchResult &result : results) {
const QTextBlock &block = q->document()->findBlock(result.start); const QTextBlock &block = q->document()->findBlock(result.start);
if (block.isValid() && block.isVisible()) { if (block.isValid() && block.isVisible()) {
if (q->lineWrapMode() == QPlainTextEdit::WidgetWidth) { if (q->lineWrapMode() == PlainTextEdit::WidgetWidth) {
const int firstLine = block.layout()->lineForTextPosition(result.start - block.position()).lineNumber(); const int firstLine = block.layout()->lineForTextPosition(result.start - block.position()).lineNumber();
const int lastLine = block.layout()->lineForTextPosition(result.start - block.position() + result.length).lineNumber(); const int lastLine = block.layout()->lineForTextPosition(result.start - block.position() + result.length).lineNumber();
for (int line = firstLine; line <= lastLine; ++line) { for (int line = firstLine; line <= lastLine; ++line) {
@@ -8245,8 +8245,7 @@ void TextEditorWidgetPrivate::addSearchResultsToScrollBar(const QList<SearchResu
Highlight::HighPriority); Highlight::HighPriority);
} }
void TextEditorWidgetPrivate::addSelectionHighlightToScrollBar( void TextEditorWidgetPrivate::addSelectionHighlightToScrollBar(const QList<SearchResult> &selections)
const QList<SearchResult> &selections)
{ {
addSearchResultsToScrollBar( addSearchResultsToScrollBar(
Constants::SCROLL_BAR_SELECTION, Constants::SCROLL_BAR_SELECTION,
@@ -8616,7 +8615,7 @@ void TextEditorWidgetPrivate::cancelCurrentAnimations()
void TextEditorWidget::changeEvent(QEvent *e) void TextEditorWidget::changeEvent(QEvent *e)
{ {
QPlainTextEdit::changeEvent(e); PlainTextEdit::changeEvent(e);
if (e->type() == QEvent::ApplicationFontChange if (e->type() == QEvent::ApplicationFontChange
|| e->type() == QEvent::FontChange) { || e->type() == QEvent::FontChange) {
if (d->m_extraArea) { if (d->m_extraArea) {
@@ -8633,14 +8632,14 @@ void TextEditorWidget::changeEvent(QEvent *e)
void TextEditorWidget::focusInEvent(QFocusEvent *e) void TextEditorWidget::focusInEvent(QFocusEvent *e)
{ {
QPlainTextEdit::focusInEvent(e); PlainTextEdit::focusInEvent(e);
d->startCursorFlashTimer(); d->startCursorFlashTimer();
d->updateHighlights(); d->updateHighlights();
} }
void TextEditorWidget::focusOutEvent(QFocusEvent *e) void TextEditorWidget::focusOutEvent(QFocusEvent *e)
{ {
QPlainTextEdit::focusOutEvent(e); PlainTextEdit::focusOutEvent(e);
d->m_hoverHandlerRunner.abortHandlers(); d->m_hoverHandlerRunner.abortHandlers();
if (viewport()->cursor().shape() == Qt::BlankCursor) if (viewport()->cursor().shape() == Qt::BlankCursor)
viewport()->setCursor(Qt::IBeamCursor); viewport()->setCursor(Qt::IBeamCursor);
@@ -8908,7 +8907,7 @@ void TextEditorWidgetPrivate::setExtraSelections(Id kind, const QList<QTextEdit:
continue; continue;
all += i.value(); all += i.value();
} }
q->QPlainTextEdit::setExtraSelections(all); q->PlainTextEdit::setExtraSelections(all);
} }
} }
@@ -9099,14 +9098,14 @@ void TextEditorWidget::encourageApply()
void TextEditorWidget::showEvent(QShowEvent* e) void TextEditorWidget::showEvent(QShowEvent* e)
{ {
triggerPendingUpdates(); triggerPendingUpdates();
// QPlainTextEdit::showEvent scrolls to make the cursor visible on first show // PlainTextEdit::showEvent scrolls to make the cursor visible on first show
// which we don't want, since we restore previous states when // which we don't want, since we restore previous states when
// opening editors, and when splitting/duplicating. // opening editors, and when splitting/duplicating.
// So restore the previous state after that. // So restore the previous state after that.
QByteArray state; QByteArray state;
if (d->m_wasNotYetShown) if (d->m_wasNotYetShown)
state = saveState(); state = saveState();
QPlainTextEdit::showEvent(e); PlainTextEdit::showEvent(e);
if (d->m_wasNotYetShown) { if (d->m_wasNotYetShown) {
restoreState(state); restoreState(state);
d->m_wasNotYetShown = false; d->m_wasNotYetShown = false;
@@ -9181,12 +9180,12 @@ void TextEditorWidget::setDisplaySettings(const DisplaySettings &ds)
{ {
const TextEditor::FontSettings &fs = TextEditorSettings::fontSettings(); const TextEditor::FontSettings &fs = TextEditorSettings::fontSettings();
if (fs.relativeLineSpacing() == 100) if (fs.relativeLineSpacing() == 100)
setLineWrapMode(ds.m_textWrapping ? QPlainTextEdit::WidgetWidth : QPlainTextEdit::NoWrap); setLineWrapMode(ds.m_textWrapping ? PlainTextEdit::WidgetWidth : PlainTextEdit::NoWrap);
else else
setLineWrapMode(QPlainTextEdit::NoWrap); setLineWrapMode(PlainTextEdit::NoWrap);
QTC_ASSERT((fs.relativeLineSpacing() == 100) || (fs.relativeLineSpacing() != 100 QTC_ASSERT((fs.relativeLineSpacing() == 100) || (fs.relativeLineSpacing() != 100
&& lineWrapMode() == QPlainTextEdit::NoWrap), setLineWrapMode(QPlainTextEdit::NoWrap)); && lineWrapMode() == PlainTextEdit::NoWrap), setLineWrapMode(PlainTextEdit::NoWrap));
setLineNumbersVisible(ds.m_displayLineNumbers); setLineNumbersVisible(ds.m_displayLineNumbers);
setHighlightCurrentLine(ds.m_highlightCurrentLine); setHighlightCurrentLine(ds.m_highlightCurrentLine);
@@ -9372,21 +9371,21 @@ void TextEditorWidget::selectAll()
{ {
// Directly update the internal multi text cursor here to prevent calling setTextCursor. // Directly update the internal multi text cursor here to prevent calling setTextCursor.
// This would indirectly make sure the cursor is visible which is not desired for select all. // This would indirectly make sure the cursor is visible which is not desired for select all.
QTextCursor c = QPlainTextEdit::textCursor(); QTextCursor c = PlainTextEdit::textCursor();
c.select(QTextCursor::Document); c.select(QTextCursor::Document);
const_cast<MultiTextCursor &>(d->m_cursors).setCursors({c}); const_cast<MultiTextCursor &>(d->m_cursors).setCursors({c});
QPlainTextEdit::selectAll(); PlainTextEdit::selectAll();
} }
void TextEditorWidget::copy() void TextEditorWidget::copy()
{ {
QPlainTextEdit::copy(); PlainTextEdit::copy();
d->collectToCircularClipboard(); d->collectToCircularClipboard();
} }
void TextEditorWidget::paste() void TextEditorWidget::paste()
{ {
QPlainTextEdit::paste(); PlainTextEdit::paste();
encourageApply(); encourageApply();
} }
@@ -9539,7 +9538,7 @@ QMimeData *TextEditorWidget::createMimeDataFromSelection(bool withHtml) const
bool TextEditorWidget::canInsertFromMimeData(const QMimeData *source) const bool TextEditorWidget::canInsertFromMimeData(const QMimeData *source) const
{ {
return QPlainTextEdit::canInsertFromMimeData(source); return PlainTextEdit::canInsertFromMimeData(source);
} }
struct MappedText struct MappedText
@@ -10190,7 +10189,7 @@ void TextEditorWidget::updateVisualWrapColumn()
void TextEditorWidgetPrivate::updateTabStops() void TextEditorWidgetPrivate::updateTabStops()
{ {
// Although the tab stop is stored as qreal the API from QPlainTextEdit only allows it // Although the tab stop is stored as qreal the API from PlainTextEdit only allows it
// to be set as an int. A work around is to access directly the QTextOption. // to be set as an int. A work around is to access directly the QTextOption.
QTextOption option = q->document()->defaultTextOption(); QTextOption option = q->document()->defaultTextOption();
option.setTabStopDistance(charWidth() * m_document->tabSettings().m_tabSize); option.setTabStopDistance(charWidth() * m_document->tabSettings().m_tabSize);

View File

@@ -18,6 +18,7 @@
#include <utils/elidinglabel.h> #include <utils/elidinglabel.h>
#include <utils/link.h> #include <utils/link.h>
#include <utils/multitextcursor.h> #include <utils/multitextcursor.h>
#include <utils/plaintextedit/plaintextedit.h>
#include <utils/textutils.h> #include <utils/textutils.h>
#include <utils/uncommentselection.h> #include <utils/uncommentselection.h>
@@ -191,7 +192,7 @@ private:
Internal::BaseTextEditorPrivate *d; Internal::BaseTextEditorPrivate *d;
}; };
class TEXTEDITOR_EXPORT TextEditorWidget : public QPlainTextEdit class TEXTEDITOR_EXPORT TextEditorWidget : public Utils::PlainTextEdit
{ {
Q_OBJECT Q_OBJECT
public: public:
@@ -213,7 +214,7 @@ public:
QTextCursor textCursorAt(int position) const; QTextCursor textCursorAt(int position) const;
Utils::Text::Position lineColumn() const; Utils::Text::Position lineColumn() const;
void convertPosition(int pos, int *line, int *column) const; void convertPosition(int pos, int *line, int *column) const;
using QPlainTextEdit::cursorRect; using PlainTextEdit::cursorRect;
QRect cursorRect(int pos) const; QRect cursorRect(int pos) const;
void setCursorPosition(int pos); void setCursorPosition(int pos);
QWidget *toolBarWidget() const; QWidget *toolBarWidget() const;

View File

@@ -736,22 +736,22 @@ void VcsBaseEditorWidget::init()
case LogOutput: case LogOutput:
connect(d->entriesComboBox(), &QComboBox::activated, connect(d->entriesComboBox(), &QComboBox::activated,
this, &VcsBaseEditorWidget::slotJumpToEntry); this, &VcsBaseEditorWidget::slotJumpToEntry);
connect(this, &QPlainTextEdit::textChanged, connect(this, &PlainTextEdit::textChanged,
this, &VcsBaseEditorWidget::slotPopulateLogBrowser); this, &VcsBaseEditorWidget::slotPopulateLogBrowser);
connect(this, &QPlainTextEdit::cursorPositionChanged, connect(this, &PlainTextEdit::cursorPositionChanged,
this, &VcsBaseEditorWidget::slotCursorPositionChanged); this, &VcsBaseEditorWidget::slotCursorPositionChanged);
break; break;
case AnnotateOutput: case AnnotateOutput:
// Annotation highlighting depends on contents, which is set later on // Annotation highlighting depends on contents, which is set later on
connect(this, &QPlainTextEdit::textChanged, this, &VcsBaseEditorWidget::slotActivateAnnotation); connect(this, &PlainTextEdit::textChanged, this, &VcsBaseEditorWidget::slotActivateAnnotation);
break; break;
case DiffOutput: case DiffOutput:
// Diff: set up diff file browsing // Diff: set up diff file browsing
connect(d->entriesComboBox(), &QComboBox::activated, connect(d->entriesComboBox(), &QComboBox::activated,
this, &VcsBaseEditorWidget::slotJumpToEntry); this, &VcsBaseEditorWidget::slotJumpToEntry);
connect(this, &QPlainTextEdit::textChanged, connect(this, &PlainTextEdit::textChanged,
this, &VcsBaseEditorWidget::slotPopulateDiffBrowser); this, &VcsBaseEditorWidget::slotPopulateDiffBrowser);
connect(this, &QPlainTextEdit::cursorPositionChanged, connect(this, &PlainTextEdit::cursorPositionChanged,
this, &VcsBaseEditorWidget::slotCursorPositionChanged); this, &VcsBaseEditorWidget::slotCursorPositionChanged);
break; break;
} }
@@ -1094,7 +1094,7 @@ void VcsBaseEditorWidget::slotActivateAnnotation()
if (changes.isEmpty()) if (changes.isEmpty())
return; return;
disconnect(this, &QPlainTextEdit::textChanged, this, &VcsBaseEditorWidget::slotActivateAnnotation); disconnect(this, &PlainTextEdit::textChanged, this, &VcsBaseEditorWidget::slotActivateAnnotation);
if (SyntaxHighlighter *ah = textDocument()->syntaxHighlighter()) { if (SyntaxHighlighter *ah = textDocument()->syntaxHighlighter()) {
ah->rehighlight(); ah->rehighlight();