forked from sqlitebrowser/sqlitebrowser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqltextedit.cpp
More file actions
45 lines (37 loc) · 1.61 KB
/
sqltextedit.cpp
File metadata and controls
45 lines (37 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "sqltextedit.h"
#include "Settings.h"
#include "SqlUiLexer.h"
SqlUiLexer* SqlTextEdit::sqlLexer = nullptr;
SqlTextEdit::SqlTextEdit(QWidget* parent) :
ExtendedScintilla(parent)
{
// Create lexer object if not done yet
if(sqlLexer == nullptr)
sqlLexer = new SqlUiLexer(this);
// Set the SQL lexer
setLexer(sqlLexer);
// Set icons for auto completion
registerImage(SqlUiLexer::ApiCompleterIconIdKeyword, QImage(":/icons/keyword"));
registerImage(SqlUiLexer::ApiCompleterIconIdFunction, QImage(":/icons/function"));
registerImage(SqlUiLexer::ApiCompleterIconIdTable, QImage(":/icons/table"));
registerImage(SqlUiLexer::ApiCompleterIconIdColumn, QImage(":/icons/field"));
// Do rest of initialisation
reloadSettings();
}
SqlTextEdit::~SqlTextEdit()
{
}
void SqlTextEdit::reloadSettings()
{
ExtendedScintilla::reloadSettings();
setupSyntaxHighlightingFormat("comment", QsciLexerSQL::Comment);
setupSyntaxHighlightingFormat("comment", QsciLexerSQL::CommentLine);
setupSyntaxHighlightingFormat("comment", QsciLexerSQL::CommentDoc);
setupSyntaxHighlightingFormat("keyword", QsciLexerSQL::Keyword);
setupSyntaxHighlightingFormat("table", QsciLexerSQL::KeywordSet6);
setupSyntaxHighlightingFormat("function", QsciLexerSQL::KeywordSet7);
setupSyntaxHighlightingFormat("string", QsciLexerSQL::DoubleQuotedString);
setupSyntaxHighlightingFormat("string", QsciLexerSQL::SingleQuotedString);
setupSyntaxHighlightingFormat("identifier", QsciLexerSQL::Identifier);
setupSyntaxHighlightingFormat("identifier", QsciLexerSQL::QuotedIdentifier);
}