diff options
Diffstat (limited to 'src/gui/text/qsyntaxhighlighter.cpp')
-rw-r--r-- | src/gui/text/qsyntaxhighlighter.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index db1a38e..ccf229e 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -356,6 +356,8 @@ QTextDocument *QSyntaxHighlighter::document() const \since 4.2 Redoes the highlighting of the whole document. + + \sa rehighlightBlock() */ void QSyntaxHighlighter::rehighlight() { @@ -375,6 +377,31 @@ void QSyntaxHighlighter::rehighlight() } /*! + \since 4.6 + + Redoes the highlighting of the given QTextBlock \a block. + + \sa rehighlight() +*/ +void QSyntaxHighlighter::rehighlightBlock(const QTextBlock &block) +{ + Q_D(QSyntaxHighlighter); + if (!d->doc) + return; + + disconnect(d->doc, SIGNAL(contentsChange(int,int,int)), + this, SLOT(_q_reformatBlocks(int,int,int))); + QTextCursor cursor(block); + cursor.beginEditBlock(); + int from = cursor.position(); + cursor.movePosition(QTextCursor::EndOfBlock); + d->_q_reformatBlocks(from, 0, cursor.position() - from); + cursor.endEditBlock(); + connect(d->doc, SIGNAL(contentsChange(int,int,int)), + this, SLOT(_q_reformatBlocks(int,int,int))); +} + +/*! \fn void QSyntaxHighlighter::highlightBlock(const QString &text) Highlights the given text block. This function is called when |