Feature request #2672

Set group/layer visibility and expansion state in QgsLegendInterface

Added by Andres Manz - over 10 years ago. Updated over 10 years ago.

Status:Closed
Priority:Low
Assignee:nobody -
Category:GUI
Pull Request or Patch supplied: Resolution:fixed
Easy fix?:No Copied to github as #:12732

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.

legendiface_ext.patch Magnifier (2.9 KB) Andres Manz -, 2010-04-23 01:31 AM

legendiface_2672_2.patch Magnifier - Improved patch (8.06 KB) Andres Manz -, 2010-04-24 03:28 PM

History

#1 Updated by Martin Dobias over 10 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

#2 Updated by Andres Manz - over 10 years ago

Hi Martin,

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

Andres

#3 Updated by Martin Dobias over 10 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

Applied in (with fixed layerCheckState function).

Thanks for contributing.

Also available in: Atom PDF