[Qgis-developer] Need help with LayerTreeModel (legend node)

Sandro Santilli strk at keybit.net
Thu Dec 18 09:37:26 PST 2014


On Thu, Dec 18, 2014 at 01:46:21PM +0100, Sandro Santilli wrote:

> The weird looking aspect seems to be due to a discrepancy between
> the actual legend image size and the space reserved for it.
> In practice I have 2 layers and the layer node for second one gets
> rendered right below the first one, with the legend of the first one
> being printed _over_ the layer node of the second, which moves down
> to the correct place on next redraw.
> 
> Could this be a bug in the QgsLayerTreeView ?

I've tried calling recursivelyEmitDataChanged() from
QgsLayerTreeModel::legendNodeDataChanged() and it effectively
fixes that problem. Is is overkill to always force redraw of the
whole layertree ? Sounds pretty fast to me...

But maybe there's a bug that'd be better fixed ?
I guess it's currently not exposed because no legend item updates
by changing its size ?

--strk;

 ()  ASCII ribbon campaign  --  Keep it simple !
 /\  http://strk.keybit.net/rants/ascii_mails.txt  


More information about the Qgis-developer mailing list