Skip to content

Commit

Permalink
[layouts] Fix data defined buttons do not update when clicking
Browse files Browse the repository at this point in the history
between items of same type

Fixes #18637, #18639
  • Loading branch information
nyalldawson committed Apr 6, 2018
1 parent 3b8d843 commit 3c08e2d
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/gui/layout/qgslayoutitemwidget.cpp
Expand Up @@ -147,13 +147,24 @@ QgsLayoutObject *QgsLayoutItemBaseWidget::layoutObject()

bool QgsLayoutItemBaseWidget::setItem( QgsLayoutItem *item )
{
QgsLayoutObject *oldObject = mObject;
QgsLayoutConfigObject *oldConfigObject = mConfigObject;
// have to set new mObject/mConfigObject here, because setNewItem methods require access to them
mObject = item;
mConfigObject = new QgsLayoutConfigObject( this, mObject );
if ( setNewItem( item ) )
{
mObject = item;
oldConfigObject->deleteLater();
return true;
}

return false;
else
{
// revert object change since it was unsuccessful
mObject = oldObject;
mConfigObject->deleteLater();
mConfigObject = oldConfigObject;
return false;
}
}

void QgsLayoutItemBaseWidget::setReportTypeString( const QString & )
Expand Down

0 comments on commit 3c08e2d

Please sign in to comment.