Skip to content

Commit

Permalink
QgsCodeEditorSQL: make autocompletion case insensitive when APIs are …
Browse files Browse the repository at this point in the history
…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.
18 changes: 17 additions & 1 deletion src/gui/qgscodeeditorsql.cpp
Expand Up @@ -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 );
Expand Down

0 comments on commit 9aa2dea

Please sign in to comment.