pgLab/sqlhighlighter.h
Eelke Klein 5831f18008 If there is a selection in the query then only that part is Executed or explained.
Replaced QTextEdit with QPLainTextEdit as it is more efficient and CAN do syntax highlighting.
2017-01-16 17:31:46 +01:00

40 lines
894 B
C++

#pragma once
#include <QSyntaxHighlighter>
#include <QRegularExpression>
#include <vector>
class SqlHighlighter : public QSyntaxHighlighter
{
Q_OBJECT
public:
SqlHighlighter(QTextDocument *parent = 0);
protected:
void highlightBlock(const QString &text) Q_DECL_OVERRIDE;
private:
struct HighlightingRule
{
QRegExp pattern;
QTextCharFormat format;
HighlightingRule(const QRegExp &regex, const QTextCharFormat &f)
: pattern(regex), format(f)
{}
};
//QVector<HighlightingRule> highlightingRules;
std::vector<HighlightingRule> highlightingRules;
// QRegExp commentStartExpression;
// QRegExp commentEndExpression;
QTextCharFormat keywordFormat;
// QTextCharFormat classFormat;
// QTextCharFormat singleLineCommentFormat;
// QTextCharFormat multiLineCommentFormat;
// QTextCharFormat quotationFormat;
// QTextCharFormat functionFormat;
};