Skip to content

Commit 10cab93

Browse files
committedOct 20, 2016
Fix building of legend node tree if embedded widgets are used in the layer
1 parent b385ebd commit 10cab93

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
 

‎src/core/layertree/qgslayertreemodel.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,20 @@ class EmbeddedWidgetLegendNode : public QgsLayerTreeModelLegendNode
4444
EmbeddedWidgetLegendNode( QgsLayerTreeLayer* nodeL )
4545
: QgsLayerTreeModelLegendNode( nodeL )
4646
{
47+
// we need a valid rule key to allow the model to build a tree out of legend nodes
48+
// if that's possible (if there is a node without a rule key, building of tree is cancelled)
49+
mRuleKey = "embedded-widget-" + QUuid::createUuid().toString();
4750
}
4851

4952
virtual QVariant data( int role ) const override
5053
{
51-
Q_UNUSED( role );
54+
if ( role == RuleKeyRole )
55+
return mRuleKey;
5256
return QVariant();
5357
}
58+
59+
private:
60+
QString mRuleKey;
5461
};
5562

5663
///@endcond

0 commit comments

Comments
 (0)
Please sign in to comment.