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

Sandro Santilli strk at keybit.net
Fri Dec 19 01:34:34 PST 2014

On Fri, Dec 19, 2014 at 03:35:39PM +0700, Martin Dobias wrote:
> On Fri, Dec 19, 2014 at 12:37 AM, Sandro Santilli <strk at keybit.net> wrote:
> >
> > 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 ?
> Most likely you just do not emit dataChanged() where it should be (I have
> seen this kind of errors in various models and this was a common problem).
> You can try using the model with plain QTreeView - it will most likely have
> the same issue.
> Maybe a missing emit dataChanged() in
> QgsWMSLegendNode::invalidateMapBasedData() ? Just guessing...

I've added logging calls and I do see the dataChanged being emitted.
Also, the _legend_ does get refreshed, so I see the new image.
Only, the position of the following layer did not move.
As if the View got the new content (decoration) but not the new size.

I'm not sure the explanation is clear.
Did you try building my branch to see ?


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

More information about the Qgis-developer mailing list