<div dir="ltr"><div>Hi</div><div><br></div><div>I'm working/investigating hwo to add WMS legend (GetLegendGraphics) in the legend tree (QgsLegend : QTreeWidget)</div><div><br></div><div>**the context:<br></div><div>I've a WMS legend that is a pixmap because of is obtained usiging GetLegendGraphic WMS call.</div>

<div>I want to show this legend as in the attached image: </div><div><br></div><div><a href="https://dl.dropboxusercontent.com/u/12837459/WMSLegend.png">https://dl.dropboxusercontent.com/u/12837459/WMSLegend.png</a><br></div>

<div><br></div><div>**problems:</div><div>as you can see in the image I'm able to display the legend pixmap, doing setIcon for the Item (Aka QgsLegendSymbolgyItem) and setSize in QTreeWidget (AKA QgsLegend) </div><div>

In this way all the icons are set to the same Size (WRONG!)</div><div><br></div><div>**the QT way?:</div><div>in QT literature the solution is adding a QStyleItemDelegate or QItemDelegate to the QTreeWidget (QgsLegend). In this delegate I can choose how to display and size all I want overloading paint and sizeHint methods.</div>

<div><br></div><div>**The architectural problem:</div><div>The problem I found is that adding an ItemDelegate it works for all elements displayed in the Tree, but the actual architecture of the Legend draw it's element in different code sites... (QgsLegend has different architecture form the Legend in Composer)</div>

<div><br></div><div>**Solutions? </div><div>There is someone that solved or approached this problem?</div><div><br></div><div>Thank you and see you in Brighton, Luigi Pirelli (<a href="mailto:luigi.pirelli@faunalia.it">luigi.pirelli@faunalia.it</a>)</div>

</div>