Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix layout legend layer title not immediately updating
Fixes #52261
  • Loading branch information
nyalldawson committed Apr 4, 2023
1 parent cb09be0 commit 93548a7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/core/auto_generated/layout/qgslayoutitemlegend.sip.in
Expand Up @@ -611,6 +611,8 @@ Returns the legend's renderer settings object.

virtual void refresh();

virtual void invalidateCache();

virtual void refreshDataDefinedProperty( QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties );


Expand Down
6 changes: 6 additions & 0 deletions src/core/layout/qgslayoutitemlegend.cpp
Expand Up @@ -198,6 +198,12 @@ void QgsLayoutItemLegend::refresh()
onAtlasFeature();
}

void QgsLayoutItemLegend::invalidateCache()
{
clearLegendCachedData();
QgsLayoutItem::invalidateCache();
}

void QgsLayoutItemLegend::draw( QgsLayoutItemRenderContext &context )
{
QPainter *painter = context.renderContext().painter();
Expand Down
1 change: 1 addition & 0 deletions src/core/layout/qgslayoutitemlegend.h
Expand Up @@ -572,6 +572,7 @@ class CORE_EXPORT QgsLayoutItemLegend : public QgsLayoutItem
public slots:

void refresh() override;
void invalidateCache() override;
void refreshDataDefinedProperty( QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties ) override;

protected:
Expand Down
1 change: 1 addition & 0 deletions src/gui/layout/qgslayoutlegendwidget.cpp
Expand Up @@ -1690,6 +1690,7 @@ void QgsLayoutLegendNodeWidget::labelChanged()
}

mLegend->adjustBoxSize();
mLegend->invalidateCache();
mLegend->update();
mLegend->endCommand();
}
Expand Down

0 comments on commit 93548a7

Please sign in to comment.