Skip to content

Commit

Permalink
Don't set cleared data defined properties to NULL in expression editor
Browse files Browse the repository at this point in the history
Fixes #18638
  • Loading branch information
nyalldawson committed Apr 6, 2018
1 parent 3c08e2d commit 6a925f9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/gui/qgspropertyoverridebutton.cpp
Expand Up @@ -591,7 +591,11 @@ void QgsPropertyOverrideButton::showExpressionDialog()
{
QgsExpressionContext context = mExpressionContextGenerator ? mExpressionContextGenerator->createExpressionContext() : QgsExpressionContext();

QgsExpressionBuilderDialog d( const_cast<QgsVectorLayer *>( mVectorLayer ), mProperty.asExpression(), this, QStringLiteral( "generic" ), context );
// build sensible initial expression text - see https://issues.qgis.org/issues/18638
QString currentExpression = ( mProperty.propertyType() == QgsProperty::StaticProperty && !mProperty.staticValue().isValid() ) ? QString()
: mProperty.asExpression();

QgsExpressionBuilderDialog d( const_cast<QgsVectorLayer *>( mVectorLayer ), currentExpression, this, QStringLiteral( "generic" ), context );
if ( d.exec() == QDialog::Accepted )
{
mExpressionString = d.expressionText().trimmed();
Expand Down

0 comments on commit 6a925f9

Please sign in to comment.