Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Python and SQL(Expression) code editors, always use monospace
And use a different color for fields in the expression editor
- Loading branch information
Showing
with
11 additions
and
8 deletions.
-
+4
−7
src/gui/qgscodeeditorpython.cpp
-
+7
−1
src/gui/qgscodeeditorsql.cpp
|
@@ -55,13 +55,10 @@ void QgsCodeEditorPython::setSciLexerPython() |
|
|
|
|
|
QsciLexerPython* pyLexer = new QsciLexerPython( this ); |
|
|
pyLexer->setDefaultFont( font ); |
|
|
pyLexer->setFont( font, 1 ); // comment |
|
|
pyLexer->setFont( font, 3 ); // singlequotes |
|
|
pyLexer->setFont( font, 4 ); // doublequotes |
|
|
pyLexer->setFont( font, 6 ); // triplequotes |
|
|
pyLexer->setColor( Qt::red, 1 ); // comment color |
|
|
pyLexer->setColor( Qt::darkGreen, 5 ); // keyword color |
|
|
pyLexer->setColor( Qt::darkBlue, 15 ); // decorator color |
|
|
pyLexer->setFont( font, -1 ); |
|
|
pyLexer->setColor( Qt::red, QsciLexerPython::Comment ); |
|
|
pyLexer->setColor( Qt::darkGreen, QsciLexerPython::Keyword ); |
|
|
pyLexer->setColor( Qt::darkBlue, QsciLexerPython::Decorator ); |
|
|
|
|
|
QsciAPIs* apis = new QsciAPIs( pyLexer ); |
|
|
|
|
|
|
@@ -41,8 +41,14 @@ QgsCodeEditorSQL::~QgsCodeEditorSQL() |
|
|
|
|
|
void QgsCodeEditorSQL::setSciLexerSQL() |
|
|
{ |
|
|
QFont font = getMonospaceFont(); |
|
|
|
|
|
QsciLexerSQL* sqlLexer = new QsciLexerSQL( this ); |
|
|
sqlLexer->setDefaultFont( QFont( "Sans", 10 ) ); |
|
|
sqlLexer->setDefaultFont( font ); |
|
|
sqlLexer->setFont( font, -1 ); |
|
|
font.setBold( true ); |
|
|
sqlLexer->setFont( font, QsciLexerSQL::Keyword ); |
|
|
sqlLexer->setColor( Qt::darkYellow, QsciLexerSQL::DoubleQuotedString ); // fields |
|
|
|
|
|
setLexer( sqlLexer ); |
|
|
} |