[layouts] Final fixes for data defined widgets showing outdated

data defined definitions when clicking between layout items
of the same type

Fixes #18694
This commit is contained in:
Nyall Dawson 2018-10-26 12:22:26 +10:00
parent 5e3fdb96b8
commit bbdbfa17a9
3 changed files with 17 additions and 0 deletions

View File

@ -55,6 +55,7 @@ Returns the current layout context coverage layer (if set).
Returns the atlas for the layout, if available
%End
};
class QgsLayoutItemBaseWidget: QgsPanelWidget

View File

@ -119,6 +119,11 @@ QgsLayoutAtlas *QgsLayoutConfigObject::layoutAtlas() const
return printLayout->atlas();
}
void QgsLayoutConfigObject::setObject( QgsLayoutObject *object )
{
mLayoutObject = object;
}
QgsVectorLayer *QgsLayoutConfigObject::coverageLayer() const
{
if ( !mLayoutObject )
@ -321,6 +326,8 @@ void QgsLayoutItemPropertiesWidget::setItem( QgsLayoutItem *item )
connect( mItem, &QgsLayoutObject::changed, this, &QgsLayoutItemPropertiesWidget::setValuesForGuiNonPositionElements );
}
mConfigObject->setObject( mItem );
setValuesForGuiElements();
}

View File

@ -86,6 +86,15 @@ class GUI_EXPORT QgsLayoutConfigObject: public QObject
//! Returns the atlas for the layout, if available
QgsLayoutAtlas *layoutAtlas() const;
/**
* Links a new layout \a object to this QgsLayoutConfigObject. The object must be the same type as the existing
* object.
*
* \note Not available in Python bindings
* \since QGIS 3.4
*/
void setObject( QgsLayoutObject *object ) SIP_SKIP;
private slots:
//! Must be called when a data defined button changes
void updateDataDefinedProperty();