Skip to content

Commit

Permalink
[layouts] Final fixes for data defined widgets showing outdated
Browse files Browse the repository at this point in the history
data defined definitions when clicking between layout items
of the same type

Fixes #18694
  • Loading branch information
nyalldawson committed Oct 26, 2018
1 parent 5e3fdb9 commit bbdbfa1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/gui/layout/qgslayoutitemwidget.cpp
Expand Up @@ -119,6 +119,11 @@ QgsLayoutAtlas *QgsLayoutConfigObject::layoutAtlas() const
return printLayout->atlas();
}

void QgsLayoutConfigObject::setObject( QgsLayoutObject *object )
{
mLayoutObject = object;
}

QgsVectorLayer *QgsLayoutConfigObject::coverageLayer() const
{
if ( !mLayoutObject )
Expand Down Expand Up @@ -321,6 +326,8 @@ void QgsLayoutItemPropertiesWidget::setItem( QgsLayoutItem *item )
connect( mItem, &QgsLayoutObject::changed, this, &QgsLayoutItemPropertiesWidget::setValuesForGuiNonPositionElements );
}

mConfigObject->setObject( mItem );

setValuesForGuiElements();
}

Expand Down
9 changes: 9 additions & 0 deletions src/gui/layout/qgslayoutitemwidget.h
Expand Up @@ -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();
Expand Down

0 comments on commit bbdbfa1

Please sign in to comment.