[Qgis-developer] QgsLegend: How to have display Pixmaps with different size?

Gino Pirelli luipir at gmail.com
Sat Sep 7 07:27:32 PDT 2013


Hi

I'm working/investigating hwo to add WMS legend (GetLegendGraphics) in the
legend tree (QgsLegend : QTreeWidget)

**the context:
I've a WMS legend that is a pixmap because of is obtained usiging
GetLegendGraphic WMS call.
I want to show this legend as in the attached image:

https://dl.dropboxusercontent.com/u/12837459/WMSLegend.png

**problems:
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)
In this way all the icons are set to the same Size (WRONG!)

**the QT way?:
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.

**The architectural problem:
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)

**Solutions?
There is someone that solved or approached this problem?

Thank you and see you in Brighton, Luigi Pirelli (luigi.pirelli at faunalia.it)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130907/9b86b1ed/attachment-0001.html>


More information about the Qgis-developer mailing list