Compiles, links and runs (functionality not tested)
This commit is contained in:
parent
04723a289b
commit
6a97c0447a
48 changed files with 224 additions and 149 deletions
42
pglab/SqlHighlighter.h
Normal file
42
pglab/SqlHighlighter.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#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) override;
|
||||
|
||||
private:
|
||||
struct HighlightingRule
|
||||
{
|
||||
QRegExp pattern;
|
||||
QTextCharFormat format;
|
||||
|
||||
HighlightingRule(const QRegExp ®ex, 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;
|
||||
|
||||
};
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue