Skip to content

Commit

Permalink
Merge pull request #42745 from gacarrillor/default_custom_expression_…
Browse files Browse the repository at this point in the history
…tweaks

Minor tweaks to expression dialog and default expression function
  • Loading branch information
rouault committed Apr 10, 2021
2 parents 497cd1b + df9a6ae commit c8b891b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion python/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def load_user_expressions(path):
template = """from qgis.core import *
from qgis.gui import *
@qgsfunction(args='auto', group='Custom')
@qgsfunction(args='auto', group='Custom', referenced_columns=[])
def my_sum(value1, value2, feature, parent):
\"\"\"
Calculates the sum of the two parameters value1 and value2.
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsexpressionbuilderwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ void QgsExpressionBuilderWidget::updateFunctionFileList( const QString &path )
{
// Create default sample entry.
newFunctionFile( "default" );
txtPython->setText( QStringLiteral( "'''\n#Sample custom function file\n "
"(uncomment to use and customize or Add button to create a new file) \n%1 \n '''" ).arg( txtPython->text() ) );
txtPython->setText( QStringLiteral( "'''\n#Sample custom function file\n"
"#(uncomment to use and customize or Add button to create a new file) \n%1 \n '''" ).arg( txtPython->text() ) );
saveFunctionFile( "default" );
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsexpressionpreviewwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void QgsExpressionPreviewWidget::refreshPreview()
if ( !mExpression.referencedColumns().isEmpty() || mExpression.needsGeometry() )
{
mPreviewLabel->setText( tr( "No feature was found on this layer to evaluate the expression." ) );
mPreviewLabel->setStyleSheet( QStringLiteral( "color: rgba(255, 6, 10, 255);" ) );
mPreviewLabel->setStyleSheet( QStringLiteral( "color: rgba(220, 125, 0, 255);" ) );
return;
}
}
Expand Down Expand Up @@ -116,7 +116,7 @@ void QgsExpressionPreviewWidget::refreshPreview()
tooltip += QStringLiteral( "<b>%1:</b> %2" ).arg( tr( "Eval Error" ), mExpression.evalErrorString() );

mPreviewLabel->setText( tr( "Expression is invalid <a href=""more"">(more info)</a>" ) );
mPreviewLabel->setStyleSheet( QStringLiteral( "color: rgba(255, 6, 10, 255);" ) );
mPreviewLabel->setStyleSheet( QStringLiteral( "color: rgba(255, 6, 10, 255);" ) );
setExpressionToolTip( tooltip );
emit expressionParsed( false );
setParserError( mExpression.hasParserError() );
Expand Down

0 comments on commit c8b891b

Please sign in to comment.