Skip to content

Commit

Permalink
Expression callTips are lowercase
Browse files Browse the repository at this point in the history
Expressions are case insensitive but in all the apis and samples lower case is used. Be conform.
  • Loading branch information
m-kuhn committed Sep 9, 2018
1 parent 4b9cc9b commit da7cc96
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/gui/qgscodeeditorexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void QgsCodeEditorExpression::initializeLexer()

void QgsCodeEditorExpression::updateApis()
{
mApis = new QsciAPIs( mSqlLexer );
mApis = new QgsSciApisExpression( mSqlLexer );

for ( const QString &var : qgis::as_const( mVariables ) )
{
Expand Down Expand Up @@ -164,4 +164,20 @@ const char *QgsLexerExpression::wordCharacters() const
{
return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_@";
}

QgsSciApisExpression::QgsSciApisExpression( QsciLexer *lexer )
: QsciAPIs( lexer )
{

}

QStringList QgsSciApisExpression::callTips( const QStringList &context, int commas, QsciScintilla::CallTipsStyle style, QList<int> &shifts )
{
const QStringList originalTips = QsciAPIs::callTips( context, commas, style, shifts );
QStringList lowercaseTips;
for ( const QString &tip : originalTips )
lowercaseTips << tip.toLower();

return lowercaseTips;
}
///@endcond
8 changes: 8 additions & 0 deletions src/gui/qgscodeeditorexpression.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ class QgsLexerExpression : public QsciLexerSQL

const char *wordCharacters() const override;
};

class QgsSciApisExpression : public QsciAPIs
{
public:
QgsSciApisExpression( QsciLexer *lexer );

QStringList callTips( const QStringList &context, int commas, QsciScintilla::CallTipsStyle style, QList<int> &shifts ) override;
};
///@endcond
#endif

Expand Down

0 comments on commit da7cc96

Please sign in to comment.