Skip to content

Commit

Permalink
[layouts] Fix some data defined buttons don't update when
Browse files Browse the repository at this point in the history
clicking between objects of same type

Refs #18694
  • Loading branch information
nyalldawson committed Oct 26, 2018
1 parent e991d98 commit 5e3fdb9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/gui/layout/qgslayoutitemwidget.cpp
Expand Up @@ -81,7 +81,7 @@ void QgsLayoutConfigObject::initializeDataDefinedButton( QgsPropertyOverrideButt
{
button->blockSignals( true );
button->init( key, mLayoutObject->dataDefinedProperties(), QgsLayoutObject::propertyDefinitions(), coverageLayer() );
connect( button, &QgsPropertyOverrideButton::changed, this, &QgsLayoutConfigObject::updateDataDefinedProperty );
connect( button, &QgsPropertyOverrideButton::changed, this, &QgsLayoutConfigObject::updateDataDefinedProperty, Qt::UniqueConnection );
button->registerExpressionContextGenerator( mLayoutObject );
button->blockSignals( false );
}
Expand All @@ -96,6 +96,10 @@ void QgsLayoutConfigObject::updateDataDefinedButton( QgsPropertyOverrideButton *

QgsLayoutObject::DataDefinedProperty key = static_cast< QgsLayoutObject::DataDefinedProperty >( button->propertyKey() );
whileBlocking( button )->setToProperty( mLayoutObject->dataDefinedProperties().property( key ) );

// In case the button was initialized to a different config object, we need to reconnect to it here (see https://issues.qgis.org/issues/18694 )
connect( button, &QgsPropertyOverrideButton::changed, this, &QgsLayoutConfigObject::updateDataDefinedProperty, Qt::UniqueConnection );
button->registerExpressionContextGenerator( mLayoutObject );
}

QgsLayoutAtlas *QgsLayoutConfigObject::layoutAtlas() const
Expand Down

0 comments on commit 5e3fdb9

Please sign in to comment.