Skip to content
Permalink
Browse files
QgsCodeEditorSQL: make autocompletion case insensitive when APIs are …
…set on the lexer
  • Loading branch information
rouault committed May 12, 2016
1 parent 4a761df commit 9aa2dea
Showing 1 changed file with 17 additions and 1 deletion.
@@ -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.