<div dir="ltr">Hi Sandro<br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 19, 2014 at 12:37 AM, Sandro Santilli <span dir="ltr"><<a href="mailto:strk@keybit.net" target="_blank">strk@keybit.net</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On Thu, Dec 18, 2014 at 01:46:21PM +0100, Sandro Santilli wrote:<br>
<br>
> The weird looking aspect seems to be due to a discrepancy between<br>
> the actual legend image size and the space reserved for it.<br>
> In practice I have 2 layers and the layer node for second one gets<br>
> rendered right below the first one, with the legend of the first one<br>
> being printed _over_ the layer node of the second, which moves down<br>
> to the correct place on next redraw.<br>
><br>
> Could this be a bug in the QgsLayerTreeView ?<br></span></blockquote><div><br></div><div>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.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I've tried calling recursivelyEmitDataChanged() from<br>
QgsLayerTreeModel::legendNodeDataChanged() and it effectively<br>
fixes that problem. Is is overkill to always force redraw of the<br>
whole layertree ? Sounds pretty fast to me...<br></blockquote><div><br></div><div>That does not look right, it looks like fixing the problem in a wrong way. That call was made to really force reload of all items when font settings have changed.</div><div> </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">But maybe there's a bug that'd be better fixed ?<br>
I guess it's currently not exposed because no legend item updates<br>
by changing its size ?<br></blockquote><div><br></div><div>Maybe a missing emit dataChanged() in QgsWMSLegendNode::invalidateMapBasedData() ? Just guessing...</div><div> </div><div>Cheers</div><div>Martin</div><div><br><div class=""><div class="h5"><a href="http://strk.keybit.net/rants/ascii_mails.txt" target="_blank"></a><br>
</div></div></div></div></div></div>