Skip to content
Permalink
Browse files

Fix setting symbol for single symbol renderer via legend dbl click

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 5612936836524eb1d85a0ab4168c80cf2b10dded
@@ -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.
@@ -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;
@@ -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.

0 comments on commit 5612936

Please sign in to comment.
You can’t perform that action at this time.