Skip to content

Commit a2b3a0c

Browse files
committedApr 3, 2023
Fix layout legend layer title not immediately updating
Fixes #52261
1 parent 011637b commit a2b3a0c

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed
 

‎python/core/auto_generated/layout/qgslayoutitemlegend.sip.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,8 @@ Returns the legend's renderer settings object.
637637

638638
virtual void refresh();
639639

640+
virtual void invalidateCache();
641+
640642
virtual void refreshDataDefinedProperty( QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties );
641643

642644

‎src/core/layout/qgslayoutitemlegend.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,12 @@ void QgsLayoutItemLegend::refresh()
229229
onAtlasFeature();
230230
}
231231

232+
void QgsLayoutItemLegend::invalidateCache()
233+
{
234+
clearLegendCachedData();
235+
QgsLayoutItem::invalidateCache();
236+
}
237+
232238
void QgsLayoutItemLegend::draw( QgsLayoutItemRenderContext &context )
233239
{
234240
QPainter *painter = context.renderContext().painter();

‎src/core/layout/qgslayoutitemlegend.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,7 @@ class CORE_EXPORT QgsLayoutItemLegend : public QgsLayoutItem
594594
public slots:
595595

596596
void refresh() override;
597+
void invalidateCache() override;
597598
void refreshDataDefinedProperty( QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties ) override;
598599

599600
protected:

‎src/gui/layout/qgslayoutlegendwidget.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,6 +1704,7 @@ void QgsLayoutLegendNodeWidget::labelChanged()
17041704
}
17051705

17061706
mLegend->adjustBoxSize();
1707+
mLegend->invalidateCache();
17071708
mLegend->update();
17081709
mLegend->endCommand();
17091710
}

0 commit comments

Comments
 (0)
Please sign in to comment.