Bug report #11902

Sorting layers in legend using python in QGIS 2.6

Added by Mohanakarthick Balan almost 6 years ago. Updated almost 6 years ago.

Status:Closed
Priority:High
Assignee:-
Category:-
Affected QGIS version:2.6.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:20112

Description

In QGIS 2.2 , I was able to sort in alphabetical order the layers simply using this:

self.maplegendtree = iface.mainWindow().findChild(QTreeWidget, "theMapLegend")
self.maplegendtree.sortItems(0, Qt.AscendingOrder)

I search a lot and I understand there where some changes with the legend in QGIS 2.6 ...

How to do it now using QGIS 2.6? Any clue?

Thank you!

Regards,
Mohanakarthick

History

#1 Updated by Giovanni Manghi almost 6 years ago

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

Please post questions in the users/developers mailing list, then if eventually an issue is confirmed file a ticket here. Cheers!

Also available in: Atom PDF