aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/cpphighlighter.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2020-06-19 10:23:29 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2020-06-19 08:40:10 +0000
commit176fbc1698c9bb845e8e064dc549d93fcf99d47f (patch)
treedbe3119193c94d8a455a586210701b5de17fada5 /src/plugins/cppeditor/cpphighlighter.cpp
parent38a156c5a40f6971abde3de786c922d9c5eb2438 (diff)
CppEditor: Fix build with Qt < 5.14
Change-Id: Ie08a7c0d19fff60b91b1855f7177813776542ef4 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/cpphighlighter.cpp')
-rw-r--r--src/plugins/cppeditor/cpphighlighter.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp
index 1d309f2b49..3b7827d211 100644
--- a/src/plugins/cppeditor/cpphighlighter.cpp
+++ b/src/plugins/cppeditor/cpphighlighter.cpp
@@ -366,7 +366,7 @@ void CppHighlighter::highlightWord(QStringRef word, int position, int length)
}
}
-bool CppHighlighter::highlightRawStringLiteral(const QStringView &text, const Token &tk)
+bool CppHighlighter::highlightRawStringLiteral(const QStringView &_text, const Token &tk)
{
// Step one: Does the lexer think this is a raw string literal?
switch (tk.kind()) {
@@ -380,6 +380,9 @@ bool CppHighlighter::highlightRawStringLiteral(const QStringView &text, const To
return false;
}
+ // TODO: Remove on upgrade to Qt >= 5.14.
+ const QString text = _text.toString();
+
// Step two: Find all the components. Bail out if we don't have a complete,
// well-formed raw string literal.
const int rOffset = text.indexOf(QLatin1String("R\""), tk.utf16charsBegin());
@@ -403,7 +406,7 @@ bool CppHighlighter::highlightRawStringLiteral(const QStringView &text, const To
const QTextCharFormat delimiterFormat = formatForCategory(C_KEYWORD);
const int stringOffset = delimiterOffset + delimiter.length() + 1;
setFormat(tk.utf16charsBegin(), stringOffset, delimiterFormat);
- setFormatWithSpaces(text.toString(), stringOffset, endDelimiterOffset - stringOffset - 1,
+ setFormatWithSpaces(text, stringOffset, endDelimiterOffset - stringOffset - 1,
formatForCategory(C_STRING));
setFormat(endDelimiterOffset - 1, delimiter.length() + 2, delimiterFormat);
return true;