[Qgis-developer] Legend refactoring branch merged

Martin Dobias wonder.sk at gmail.com
Wed May 21 23:50:41 PDT 2014


Hi Luca

On Thu, May 22, 2014 at 1:15 PM, Luca Manganelli <luca76 at gmail.com> wrote:
> On Wed, May 21, 2014 at 7:11 PM, Martin Dobias <wonder.sk at gmail.com> wrote:
>> Hi everyone
>>
>> I have just merged the first part of the legend refactoring work to
>> master [1]. It does not really bring any new features for the end
>> user, the changes are mainly under the hood. Things should ideally
>> work as before, if not then probably it is a bug.
>
> Interesting. So your changes will be in Qgis 2.4?

Yes.

> Another question: one thing that was missing to plugins is to set the
> layer position in the legend, after I've added it to the map... It's
> now possible with your commit?

Yes, plugins now have full control of project's layer tree. Simply
obtain the tree (QgsProject::layerTreeRoot()), create a new layer node
(QgsLayerTreeLayer) and add it where it should go
(QgsLayerTreeGroup::insertChildNode()). You will probably want to add
the layer to layer registry without emitting a signal from registry
(QgsMapLayerRegistry::addMapLayer(layer, false)) otherwise it will be
added to the layer tree twice.

Python bindings for the new classes are coming very soon.

Enjoy :-)

Regards
Martin


More information about the Qgis-developer mailing list