diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-09-03 20:59:55 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-09-03 20:59:55 +0000 |
commit | 16b8817f9fc21f89cd989ebaa3910ab9198739ce (patch) | |
tree | 6965dc0d48bd8ea5e4cd379eac4bfbaec50c4d5d | |
parent | c1c1383e235a85d504f476b25c0b41bbfe8d927c (diff) |
WPS editor:
* Order is important in highlighting rules!
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18403 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | utils/wpseditor/gui/src/qsyntaxer.cpp | 25 | ||||
-rw-r--r-- | utils/wpseditor/gui/src/qsyntaxer.h | 2 |
2 files changed, 13 insertions, 14 deletions
diff --git a/utils/wpseditor/gui/src/qsyntaxer.cpp b/utils/wpseditor/gui/src/qsyntaxer.cpp index fa2608be45..9c4cdd4653 100644 --- a/utils/wpseditor/gui/src/qsyntaxer.cpp +++ b/utils/wpseditor/gui/src/qsyntaxer.cpp @@ -6,24 +6,23 @@ QSyntaxer::QSyntaxer(QTextDocument *parent) : QSyntaxHighlighter(parent) { HighlightingRule rule; - hrules["operator"].pattern = QRegExp("%[^\\| \n<\\?%]{1,2}"); - hrules["operator"].format.setFontWeight(QFont::Bold); - hrules["operator"].format.setForeground(Qt::darkBlue); + hrules[0].pattern = QRegExp("%[^\\| \n<\\?%]{1,2}"); + hrules[0].format.setFontWeight(QFont::Bold); + hrules[0].format.setForeground(Qt::darkBlue); - hrules["question"].pattern = QRegExp("%[\\?]{1}[^<]{1,2}"); - hrules["question"].format.setForeground(Qt::darkMagenta); - - hrules["question2"].pattern = QRegExp("(<|>)"); - hrules["question2"].format.setForeground(Qt::red); + hrules[1].pattern = QRegExp("%[\\?]{1}[^<]{1,2}"); + hrules[1].format.setForeground(Qt::darkMagenta); + hrules[2].pattern = QRegExp("(<|>)"); + hrules[2].format.setForeground(Qt::red); - hrules["limiter"].pattern = QRegExp("\\|"); - hrules["limiter"].format.setForeground(Qt::darkRed); + hrules[3].pattern = QRegExp("\\|"); + hrules[3].format.setForeground(Qt::darkRed); - hrules["comment"].pattern = QRegExp("#[^\n]*"); - hrules["comment"].format.setForeground(Qt::darkGreen); - hrules["comment"].format.setFontItalic(true); + hrules[4].pattern = QRegExp("#[^\n]*"); + hrules[4].format.setForeground(Qt::darkGreen); + hrules[4].format.setFontItalic(true); } // void QSyntaxer::highlightBlock(const QString &text) { diff --git a/utils/wpseditor/gui/src/qsyntaxer.h b/utils/wpseditor/gui/src/qsyntaxer.h index b85651cf69..893eac61a6 100644 --- a/utils/wpseditor/gui/src/qsyntaxer.h +++ b/utils/wpseditor/gui/src/qsyntaxer.h @@ -11,7 +11,7 @@ class QSyntaxer : public QSyntaxHighlighter { QRegExp pattern; QTextCharFormat format; }; - QMap<QString,HighlightingRule> hrules; + QMap<int,HighlightingRule> hrules; public: QSyntaxer(QTextDocument *parent = 0); |