aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/syntaxhighlighter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/texteditor/syntaxhighlighter.cpp')
-rw-r--r--src/plugins/texteditor/syntaxhighlighter.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/plugins/texteditor/syntaxhighlighter.cpp b/src/plugins/texteditor/syntaxhighlighter.cpp
index de72c7b0db6..6d2616193ef 100644
--- a/src/plugins/texteditor/syntaxhighlighter.cpp
+++ b/src/plugins/texteditor/syntaxhighlighter.cpp
@@ -23,8 +23,12 @@ class SyntaxHighlighterPrivate
Q_DECLARE_PUBLIC(SyntaxHighlighter)
public:
SyntaxHighlighterPrivate()
+ : SyntaxHighlighterPrivate(TextEditorSettings::fontSettings())
+ { }
+
+ SyntaxHighlighterPrivate(const FontSettings &fontSettings)
{
- updateFormats(TextEditorSettings::fontSettings());
+ updateFormats(fontSettings);
}
QPointer<QTextDocument> doc;
@@ -76,6 +80,16 @@ void SyntaxHighlighter::delayedRehighlight()
rehighlight();
}
+#ifdef WITH_TESTS
+SyntaxHighlighter::SyntaxHighlighter(QTextDocument *parent, const FontSettings &fontsettings)
+ : QObject(parent), d_ptr(new SyntaxHighlighterPrivate(fontsettings))
+{
+ d_ptr->q_ptr = this;
+ if (parent)
+ setDocument(parent);
+}
+#endif
+
void SyntaxHighlighterPrivate::applyFormatChanges(int from, int charsRemoved, int charsAdded)
{
bool formatsChanged = false;