summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor/cpphighlighter.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2010-06-01 10:08:00 +0200
committerRoberto Raggi <roberto.raggi@nokia.com>2010-06-01 11:58:43 +0200
commit829df11c9d30e38fa9a6a3e57420d1bc7c63008c (patch)
tree6bc20dc518400db2215df10cde25509a0a284583 /src/plugins/cppeditor/cpphighlighter.cpp
parentefc01fd994a4d7fcc6cc55137bb8c57588d9efa1 (diff)
downloadqt-creator-829df11c9d30e38fa9a6a3e57420d1bc7c63008c.tar.gz
Recognize Q_* and QT_* as reserved keywords.
Diffstat (limited to 'src/plugins/cppeditor/cpphighlighter.cpp')
-rw-r--r--src/plugins/cppeditor/cpphighlighter.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp
index 4575fa9ec5..25354f4487 100644
--- a/src/plugins/cppeditor/cpphighlighter.cpp
+++ b/src/plugins/cppeditor/cpphighlighter.cpp
@@ -359,16 +359,18 @@ void CppHighlighter::highlightLine(const QString &text, int position, int length
void CppHighlighter::highlightWord(QStringRef word, int position, int length)
{
// try to highlight Qt 'identifiers' like QObject and Q_PROPERTY
- // but don't highlight words like 'Query'
- if (word.length() > 1 && word.at(0) == QLatin1Char('Q')) {
- for (int i = 1; i < word.length(); ++i) {
- const QChar &ch = word.at(i);
- if (! (ch.isUpper() || ch == QLatin1Char('_')))
- return;
- }
+ if (word.length() > 2 && word.at(0) == QLatin1Char('Q')) {
+ if (word.at(1) == QLatin1Char('_') // Q_
+ || word.at(1) == QLatin1Char('T') && word.at(2) == QLatin1Char('_')) { // QT_
+ for (int i = 1; i < word.length(); ++i) {
+ const QChar &ch = word.at(i);
+ if (! (ch.isUpper() || ch == QLatin1Char('_')))
+ return;
+ }
- setFormat(position, length, m_formats[CppTypeFormat]);
+ setFormat(position, length, m_formats[CppTypeFormat]);
+ }
}
}