Skip to content
Permalink
Browse files

Don't set cleared data defined properties to NULL in expression editor

Fixes #18638
  • Loading branch information
nyalldawson committed Apr 6, 2018
1 parent 3c08e2d commit 6a925f9e87894a09a4866610654603025a883663
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/gui/qgspropertyoverridebutton.cpp
@@ -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();

0 comments on commit 6a925f9

Please sign in to comment.
You can’t perform that action at this time.