Skip to content

Commit

Permalink
[composer] Instant feedback for legend when linked map changes
Browse files Browse the repository at this point in the history
(cherry-picked from f9ff5e2)
  • Loading branch information
nyalldawson committed Jul 1, 2016
1 parent 4d14d36 commit 2872495
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/core/composer/qgscomposerlegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ void QgsComposerLegend::updateLegend()

void QgsComposerLegend::updateItem()
{
updateFilterByMap();
updateFilterByMap( false );
QgsComposerItem::updateItem();
}

Expand Down Expand Up @@ -605,7 +605,7 @@ void QgsComposerLegend::mapLayerStyleOverridesChanged()
{
// legend is being filtered by map, so we need to re run the hit test too
// as the style overrides may also have affected the visible symbols
updateFilterByMap();
updateFilterByMap( false );
}
else
{
Expand All @@ -619,14 +619,17 @@ void QgsComposerLegend::mapLayerStyleOverridesChanged()
updateItem();
}

void QgsComposerLegend::updateFilterByMap()
void QgsComposerLegend::updateFilterByMap( bool redraw )
{
if ( isRemoved() )
return;
// ask for update
// the actual update will take place before the redraw.
// This is to avoid multiple calls to the filter
mFilterAskedForUpdate = true;

if ( redraw )
QgsComposerItem::updateItem();
}

void QgsComposerLegend::doUpdateFilterByMap()
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposerlegend.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class CORE_EXPORT QgsComposerLegend : public QgsComposerItem
void invalidateCurrentMap();

private slots:
void updateFilterByMap();
void updateFilterByMap( bool redraw = true );

//! update legend in case style of associated map has changed
void mapLayerStyleOverridesChanged();
Expand Down

0 comments on commit 2872495

Please sign in to comment.