Skip to content

Commit 5e3fdb9

Browse files
committed
[layouts] Fix some data defined buttons don't update when
clicking between objects of same type Refs #18694
1 parent e991d98 commit 5e3fdb9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/gui/layout/qgslayoutitemwidget.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void QgsLayoutConfigObject::initializeDataDefinedButton( QgsPropertyOverrideButt
8181
{
8282
button->blockSignals( true );
8383
button->init( key, mLayoutObject->dataDefinedProperties(), QgsLayoutObject::propertyDefinitions(), coverageLayer() );
84-
connect( button, &QgsPropertyOverrideButton::changed, this, &QgsLayoutConfigObject::updateDataDefinedProperty );
84+
connect( button, &QgsPropertyOverrideButton::changed, this, &QgsLayoutConfigObject::updateDataDefinedProperty, Qt::UniqueConnection );
8585
button->registerExpressionContextGenerator( mLayoutObject );
8686
button->blockSignals( false );
8787
}
@@ -96,6 +96,10 @@ void QgsLayoutConfigObject::updateDataDefinedButton( QgsPropertyOverrideButton *
9696

9797
QgsLayoutObject::DataDefinedProperty key = static_cast< QgsLayoutObject::DataDefinedProperty >( button->propertyKey() );
9898
whileBlocking( button )->setToProperty( mLayoutObject->dataDefinedProperties().property( key ) );
99+
100+
// 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 )
101+
connect( button, &QgsPropertyOverrideButton::changed, this, &QgsLayoutConfigObject::updateDataDefinedProperty, Qt::UniqueConnection );
102+
button->registerExpressionContextGenerator( mLayoutObject );
99103
}
100104

101105
QgsLayoutAtlas *QgsLayoutConfigObject::layoutAtlas() const

0 commit comments

Comments
 (0)