Skip to content

Commit

Permalink
Set frame DD properties
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso authored and github-actions[bot] committed Jan 31, 2022
1 parent bcd38e6 commit 61401f1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/gui/layout/qgslayoutattributetablewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ bool QgsLayoutAttributeTableWidget::setNewItem( QgsLayoutItem *item )
}

mTable = qobject_cast< QgsLayoutItemAttributeTable * >( multiFrame );
frame->setDataDefinedProperties( multiFrame->dataDefinedProperties() );
mFrame = frame;
mItemPropertiesWidget->setItem( frame );

Expand Down
22 changes: 21 additions & 1 deletion src/gui/layout/qgslayoutitemwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,27 @@ void QgsLayoutConfigObject::updateDataDefinedButton( QgsPropertyOverrideButton *
return;

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

//set the data defined property
if ( propertyAssociatesWithMultiFrame )
{
if ( QgsLayoutFrame *frame = dynamic_cast< QgsLayoutFrame * >( mLayoutObject.data() ) )
{
if ( QgsLayoutMultiFrame *multiFrame = frame->multiFrame() )
{
whileBlocking( button )->setToProperty( multiFrame->dataDefinedProperties().property( key ) );
}
}
else if ( QgsLayoutMultiFrame *multiFrame = dynamic_cast< QgsLayoutMultiFrame * >( mLayoutObject.data() ) )
{
whileBlocking( button )->setToProperty( multiFrame->dataDefinedProperties().property( key ) );
}
}
else if ( mLayoutObject )
{
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://github.com/qgis/QGIS/issues/26582 )
connect( button, &QgsPropertyOverrideButton::changed, this, &QgsLayoutConfigObject::updateDataDefinedProperty, Qt::UniqueConnection );
Expand Down

0 comments on commit 61401f1

Please sign in to comment.