Logo Search packages:      
Sourcecode: ktikz version File versions  Download package

void TikzHighlighter::highlightBlock ( const QString &  text ) [protected]

Implements QSyntaxHighlighter::highlightBlock()

See also:
QSyntaxHighlighter::highlightBlock()

Definition at line 107 of file tikzeditorhighlighter.cpp.

References m_highlightingRules, and HighlightingRule::pattern.

{
      // Try each highlighting pattern and apply formatting if it matches
      foreach (const HighlightingRule &rule, m_highlightingRules)
      {
//          const QRegExp expression(rule.pattern);
//          int index = text.indexOf(expression);
            QRegExp expression(rule.pattern);
            int index = expression.indexIn(text);
            while (index >= 0)
            {
                  const int length = expression.matchedLength();
                  if (index == 0 || text.at(index-1) != '\\')
                        setFormat(index, length, m_formatList[rule.type]);
//                index = text.indexOf(expression, index + length);
                  index = expression.indexIn(text, index + length);
            }
      }
      setCurrentBlockState(0);
}

Generated by  Doxygen 1.6.0   Back to index