Skip to content

Commit

Permalink
Fix setting symbol for single symbol renderer via legend dbl click
Browse files Browse the repository at this point in the history
Eg if diagram legend is also shown for layer it's possible for the
single symbol renderer to show a legend item.
  • Loading branch information
nyalldawson committed Mar 1, 2016
1 parent 11cebff commit 5612936
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/core/symbology-ng/qgssinglesymbolrendererv2.sip
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ class QgsSingleSymbolRendererV2 : QgsFeatureRendererV2

virtual QSet< QString > legendKeysForFeature( QgsFeature& feature, QgsRenderContext& context );

virtual void setLegendSymbolItem( const QString& key, QgsSymbolV2* symbol /Transfer/ )

//! creates a QgsSingleSymbolRendererV2 from an existing renderer.
//! @note added in 2.5
//! @returns a new renderer if the conversion was possible, otherwise 0.
Expand Down
6 changes: 6 additions & 0 deletions src/core/symbology-ng/qgssinglesymbolrendererv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,12 @@ QSet< QString > QgsSingleSymbolRendererV2::legendKeysForFeature( QgsFeature& fea
return QSet< QString >() << QString();
}

void QgsSingleSymbolRendererV2::setLegendSymbolItem( const QString& key, QgsSymbolV2* symbol )
{
Q_UNUSED( key );
setSymbol( symbol );
}

QgsSingleSymbolRendererV2* QgsSingleSymbolRendererV2::convertFromRenderer( const QgsFeatureRendererV2 *renderer )
{
QgsSingleSymbolRendererV2* r = nullptr;
Expand Down
2 changes: 2 additions & 0 deletions src/core/symbology-ng/qgssinglesymbolrendererv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ class CORE_EXPORT QgsSingleSymbolRendererV2 : public QgsFeatureRendererV2

virtual QSet< QString > legendKeysForFeature( QgsFeature& feature, QgsRenderContext& context ) override;

virtual void setLegendSymbolItem( const QString& key, QgsSymbolV2* symbol ) override;

//! creates a QgsSingleSymbolRendererV2 from an existing renderer.
//! @note added in 2.5
//! @returns a new renderer if the conversion was possible, otherwise 0.
Expand Down

0 comments on commit 5612936

Please sign in to comment.