git-svn-id: svn://db.shs.com.ru/libs@1 a8b55f48-bf90-11e4-a774-851b48703e85
32 lines
679 B
C++
32 lines
679 B
C++
#ifndef CONF_HIGHLIGHTER_H
|
|
#define CONF_HIGHLIGHTER_H
|
|
|
|
#include <QSyntaxHighlighter>
|
|
#include <QTextCursor>
|
|
#include <QTextCharFormat>
|
|
|
|
class QTextDocument;
|
|
|
|
class ConfigHighlighter : public QSyntaxHighlighter
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
ConfigHighlighter(QTextDocument *parent = 0);
|
|
|
|
QTextCursor cursor;
|
|
|
|
private:
|
|
void highlightBlock(const QString &text);
|
|
|
|
struct HighlightingRule {
|
|
QRegExp pattern;
|
|
QTextCharFormat format;
|
|
};
|
|
|
|
QVector<HighlightingRule> highlightingRules;
|
|
QRegExp commentStartExpression, commentEndExpression;
|
|
QTextCharFormat singleLineCommentFormat, valueNameFormat, valueFormat, equalFormat, sectionFormat, spaceFormat;
|
|
};
|
|
|
|
#endif // CONF_HIGHTLIGHTER_H
|