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
  • Loading branch information
nyalldawson committed Jun 16, 2016
1 parent dbf8d89 commit f9ff5e2
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 @@ -305,7 +305,7 @@ void QgsComposerLegend::updateLegend()

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

Expand Down Expand Up @@ -604,7 +604,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 @@ -618,14 +618,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 f9ff5e2

Please sign in to comment.