diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2017-03-19 19:57:04 +0200 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2017-03-20 14:57:26 +0000 |
commit | a4e23025f0ae34ca3f96474b28aefd51a668b8ad (patch) | |
tree | b16ad89b60730f9d5337da8d5c88357659bc1df1 /src/plugins/texteditor/syntaxhighlighter.cpp | |
parent | 0170e10af18c2954d800b7f7fafd33ec76c299e2 (diff) | |
download | qt-creator-a4e23025f0ae34ca3f96474b28aefd51a668b8ad.tar.gz |
TextEditor: Complete transition to Qt5-style connects
Change-Id: I78c84254a5ea56b5f9a478b6e1c9b4ed58937687
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/texteditor/syntaxhighlighter.cpp')
-rw-r--r-- | src/plugins/texteditor/syntaxhighlighter.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/plugins/texteditor/syntaxhighlighter.cpp b/src/plugins/texteditor/syntaxhighlighter.cpp index 2c625f0303..e038ecf4f8 100644 --- a/src/plugins/texteditor/syntaxhighlighter.cpp +++ b/src/plugins/texteditor/syntaxhighlighter.cpp @@ -51,7 +51,6 @@ public: QPointer<QTextDocument> doc; - void _q_reformatBlocks(int from, int charsRemoved, int charsAdded); void reformatBlocks(int from, int charsRemoved, int charsAdded); void reformatBlock(const QTextBlock &block, int from, int charsRemoved, int charsAdded); @@ -63,13 +62,6 @@ public: inReformatBlocks = false; } - inline void _q_delayedRehighlight() { - if (!rehighlightPending) - return; - rehighlightPending = false; - q_func()->rehighlight(); - } - void applyFormatChanges(int from, int charsRemoved, int charsAdded); void updateFormatsForCategories(const FontSettings &fontSettings); @@ -94,6 +86,15 @@ static bool adjustRange(QTextLayout::FormatRange &range, int from, int charsRemo return false; } +void SyntaxHighlighter::delayedRehighlight() +{ + Q_D(SyntaxHighlighter); + if (!d->rehighlightPending) + return; + d->rehighlightPending = false; + rehighlight(); +} + void SyntaxHighlighterPrivate::applyFormatChanges(int from, int charsRemoved, int charsAdded) { bool formatsChanged = false; @@ -172,10 +173,11 @@ void SyntaxHighlighterPrivate::applyFormatChanges(int from, int charsRemoved, in } } -void SyntaxHighlighterPrivate::_q_reformatBlocks(int from, int charsRemoved, int charsAdded) +void SyntaxHighlighter::reformatBlocks(int from, int charsRemoved, int charsAdded) { - if (!inReformatBlocks) - reformatBlocks(from, charsRemoved, charsAdded); + Q_D(SyntaxHighlighter); + if (!d->inReformatBlocks) + d->reformatBlocks(from, charsRemoved, charsAdded); } void SyntaxHighlighterPrivate::reformatBlocks(int from, int charsRemoved, int charsAdded) @@ -310,8 +312,7 @@ void SyntaxHighlighter::setDocument(QTextDocument *doc) { Q_D(SyntaxHighlighter); if (d->doc) { - disconnect(d->doc, SIGNAL(contentsChange(int,int,int)), - this, SLOT(_q_reformatBlocks(int,int,int))); + disconnect(d->doc, &QTextDocument::contentsChange, this, &SyntaxHighlighter::reformatBlocks); QTextCursor cursor(d->doc); cursor.beginEditBlock(); @@ -321,10 +322,9 @@ void SyntaxHighlighter::setDocument(QTextDocument *doc) } d->doc = doc; if (d->doc) { - connect(d->doc, SIGNAL(contentsChange(int,int,int)), - this, SLOT(_q_reformatBlocks(int,int,int))); + connect(d->doc, &QTextDocument::contentsChange, this, &SyntaxHighlighter::reformatBlocks); d->rehighlightPending = true; - QTimer::singleShot(0, this, SLOT(_q_delayedRehighlight())); + QTimer::singleShot(0, this, &SyntaxHighlighter::delayedRehighlight); d->foldValidator.setup(qobject_cast<TextDocumentLayout *>(doc->documentLayout())); } } |