35 setAutoCompletionCaseSensitivity(
false );
40 void QgsCodeEditorSQL::setSciLexerSQL()
42 QHash< QString, QColor > colors;
46 for (
const auto &key : ini.allKeys() )
55 font.setPointSize( QLabel().font().pointSize() );
57 QColor defaultColor = colors.value( QStringLiteral(
"sql/defaultFontColor" ), Qt::black );
59 QsciLexerSQL *sqlLexer =
new QgsCaseInsensitiveLexerSQL(
this );
60 sqlLexer->setDefaultFont( font );
61 sqlLexer->setDefaultColor( defaultColor );
62 sqlLexer->setDefaultPaper( colors.value( QStringLiteral(
"sql/paperBackgroundColor" ), Qt::white ) );
63 sqlLexer->setFont( font, -1 );
65 sqlLexer->setFont( font, QsciLexerSQL::Keyword );
67 sqlLexer->setColor( defaultColor, QsciLexerSQL::Default );
68 sqlLexer->setColor( colors.value( QStringLiteral(
"sql/commentFontColor" ), QColor( 142, 144, 140 ) ), QsciLexerSQL::Comment );
69 sqlLexer->setColor( colors.value( QStringLiteral(
"sql/commentLineFontColor" ), QColor( 142, 144, 140 ) ), QsciLexerSQL::CommentLine );
70 sqlLexer->setColor( colors.value( QStringLiteral(
"sql/numberFontColor" ), QColor( 200, 40, 41 ) ), QsciLexerSQL::Number );
71 sqlLexer->setColor( colors.value( QStringLiteral(
"sql/keywordFontColor" ), QColor( 137, 89, 168 ) ), QsciLexerSQL::Keyword );
72 sqlLexer->setColor( colors.value( QStringLiteral(
"sql/singleQuoteFontColor" ), QColor( 113, 140, 0 ) ), QsciLexerSQL::SingleQuotedString );
73 sqlLexer->setColor( colors.value( QStringLiteral(
"sql/doubleQuoteFontColor" ), QColor( 234, 183, 0 ) ), QsciLexerSQL::DoubleQuotedString );
74 sqlLexer->setColor( colors.value( QStringLiteral(
"sql/operatorFontColor" ), QColor( 66, 113, 174 ) ), QsciLexerSQL::Operator );
75 sqlLexer->setColor( colors.value( QStringLiteral(
"sql/identifierFontColor" ), QColor( 62, 153, 159 ) ), QsciLexerSQL::Identifier );
76 sqlLexer->setColor( colors.value( QStringLiteral(
"sql/QuotedIdentifierFontColor" ), Qt::black ), QsciLexerSQL::QuotedIdentifier );
77 sqlLexer->setColor( colors.value( QStringLiteral(
"sql/QuotedOperatorFontColor" ), Qt::black ), QsciLexerSQL::QuotedOperator );
A text editor based on QScintilla2.
static QgsApplication * instance()
Returns the singleton instance of the QgsApplication.
void setFoldingVisible(bool folding)
Set folding visible state.
QgsCodeEditorSQL(QWidget *parent=nullptr)
Constructor for QgsCodeEditorSQL.
void setMarginVisible(bool margin)
Set margin visible state.
void setTitle(const QString &title)
Set the widget title.
static QColor decodeColor(const QString &str)