Skip to content
Permalink
Browse files

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

Fixes #18638

(cherry-picked from 6a925f9)
  • Loading branch information
nyalldawson committed Apr 6, 2018
1 parent ca607f2 commit 7f24b6f4a3adfc9756de0c5c6351c28f7105a422
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 7f24b6f

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