Skip to content
Permalink
Browse files

QgsCodeEditorSQL: make autocompletion case insensitive when APIs are …

…set on the lexer
  • Loading branch information
rouault committed Apr 19, 2016
1 parent 4a761df commit 9aa2dea3418088b75b78a29f5ec4d716c4bb7520
Showing with 17 additions and 1 deletion.
  1. +17 −1 src/gui/qgscodeeditorsql.cpp
@@ -39,11 +39,27 @@ QgsCodeEditorSQL::~QgsCodeEditorSQL()
{
}

/** Internal use.
setAutoCompletionCaseSensitivity( false ) is not sufficient when installing
a lexer, since its caseSensitive() method is actually used, and defaults
to true.
@note not available in Python bindings
*/
class QgsCaseInsensitiveLexerSQL: public QsciLexerSQL
{
public:
//! constructor
QgsCaseInsensitiveLexerSQL( QObject *parent = 0 ) : QsciLexerSQL( parent ) {}

bool caseSensitive() const override { return false; }
};

void QgsCodeEditorSQL::setSciLexerSQL()
{
QFont font = getMonospaceFont();

QsciLexerSQL* sqlLexer = new QsciLexerSQL( this );
QsciLexerSQL* sqlLexer = new QgsCaseInsensitiveLexerSQL( this );
sqlLexer->setDefaultFont( font );
sqlLexer->setFont( font, -1 );
font.setBold( true );

0 comments on commit 9aa2dea

Please sign in to comment.
You can’t perform that action at this time.