Opened 14 years ago

Closed 14 years ago

#2672 closed patch (fixed)

Set group/layer visibility and expansion state in QgsLegendInterface

Reported by: andresmanz Owned by: nobody
Priority: minor: annoyance Milestone: Version 1.5.0
Component: GUI Version: Trunk
Keywords: Cc:
Must Fix for Release: No Platform: All
Platform Version: Awaiting user input: no

Description

Would be nice to set group and/or layer visibility (check state) and expansion state in QgsLegendInterface. I just need it for my plugin, but I thought maybe somebody else could use it someday.

Attachments (2)

legendiface_ext.patch (2.9 KB ) - added by andresmanz 14 years ago.
legendiface_2672_2.patch (8.1 KB ) - added by andresmanz 14 years ago.
Improved patch

Download all attachments as: .zip

Change History (6)

by andresmanz, 14 years ago

Attachment: legendiface_ext.patch added

comment:1 by andresmanz, 14 years ago

Component: Python plugins and bindingsGUI
Owner: changed from borysiasty to nobody

comment:2 by wonder, 14 years ago

Hi,

thanks for the patch. I have some suggestions for improvement of the patch in order to commit it:

  • setItemVisible works with both groups and layers, but only on top level. It would be better to split the functionality into two functions, e.g. setGroupVisible and setLayerVisible - where groups would be identified by the index, layers by the pointer to QgsMapLayer to keep the API consistent
  • the "setter" functions should get also appropriate "getter" function to query the state, e.g. for setGroupExpanded there should be a function isGroupExpanded.

Looking forward to see the improved patch,

Martin

by andresmanz, 14 years ago

Attachment: legendiface_2672_2.patch added

Improved patch

comment:3 by andresmanz, 14 years ago

Hi Martin,

Thanks for your suggestions. I hope the new patch is OK. Added a groupExists function, too.

Andres

comment:4 by wonder, 14 years ago

Resolution: fixed
Status: newclosed

Applied in r13383 (with fixed layerCheckState function).

Thanks for contributing.

Note: See TracTickets for help on using tickets.