Hi Marco,

thanks for your help. Tried to get composer legend width using
rect().width() and always get 4.0 for different legends. In same
time seems that height is reported correctly. For tests I use
several layers with categorized legend and different number of
classes (from 2 to 40) and next code from Python console

r = qgis.utils.iface.mapCanvas().mapRenderer()
c = QgsComposition( r )
c.setPlotStyle( QgsComposition.Print )
l = QgsComposerLegend( c )
l.model().setLayerSet( r.layerSet() )
print l.rect().width(), l.rect.height()

Any ideas what's wrong?

2012/2/23 Marco Hugentobler <marco.hugentob...@sourcepole.ch>:
> Hi Alex
>
> The methods to get width and height are defined in the parent class
> QGraphicsRectItem. Just use QgsGraphicsItem::rect().width() and
> QGraphicsRectItem::height().
> To set width and height, you may use QgsComposerItem::setItemPosition()
>
> Regards,
> Marco

Thanks
-- 
Alexander Bruy
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to