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.

(cherry-picked from 5612936)
  • Loading branch information
nyalldawson committed Mar 1, 2016
1 parent b11efdb commit 1b7e5c50a899f3be63f3af682487ea6d1ac14418
@@ -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 1b7e5c5

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