Bug report #6879

addGroup() never allows adding to the "invisible root" group

Added by Sandro Santilli almost 7 years ago. Updated over 6 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:Sandro Santilli
Category:Map Legend
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed
Crashes QGIS or corrupts data:No Copied to github as #:16008

Description

The code for addGroup defaults to the so-called "invisible root item" as the parent,
but then refuses to add there because the "invisible root item" is not a group.

This makes it impossible to add a group to the root, basically (from python)

Associated revisions

Revision 122cff78
Added by Sandro Santilli almost 7 years ago

Fix addGroup() not to refuse invisibleRootItem as the group parent

Fixes #6879.
NOTE: if a caller really wants to add a group to current item
there's a specific method for that: addGroupToCurrentItem

Revision 816c32bd
Added by Sandro Santilli over 6 years ago

Fix adding groups to empty projects

Closes #6879 again

History

#1 Updated by Sandro Santilli almost 7 years ago

  • Status changed from Open to Closed

#2 Updated by Alexander Bruy almost 7 years ago

  • Status changed from Closed to Reopened

After this commit it is impossible to create groups in empty project or add new group without selecting existing item in legend

#3 Updated by Giovanni Manghi over 6 years ago

  • Priority changed from Normal to Severe/Regression

#4 Updated by Giovanni Manghi over 6 years ago

maybe somwhow this commit fixed also #6879

if it is going to be reverted please check again also #6879.

#5 Updated by Sandro Santilli over 6 years ago

Alex, when I tested this the db_manager plugin (sub-plugin topoviewer) was successfully adding groups to the "invisible root". Are you talking about GUI or python API or what ?

#6 Updated by Giovanni Manghi over 6 years ago

Sandro Santilli wrote:

Alex, when I tested this the db_manager plugin (sub-plugin topoviewer) was successfully adding groups to the "invisible root". Are you talking about GUI or python API or what ?

GUI (I can confirm the issue)

#7 Updated by Alexander Bruy over 6 years ago

Sandro, I tested this from GUI

#8 Updated by Sandro Santilli over 6 years ago

  • Assignee set to Sandro Santilli

Confirmed. I'm on it.

#9 Updated by Sandro Santilli over 6 years ago

  • Status changed from Reopened to Closed

#10 Updated by Sandro Santilli over 6 years ago

there might be another regression, specifically the impossibility to determine where the new group is added (ie: now if you don't select a group item the new group is added to the root, not to the same group of the selected layer).

#11 Updated by Giovanni Manghi over 6 years ago

  • Status changed from Closed to Reopened

Sandro Santilli wrote:

there might be another regression, specifically the impossibility to determine where the new group is added (ie: now if you don't select a group item the new group is added to the root, not to the same group of the selected layer).

if I understand well, yes is a regression, as before selecting a group and creating a new group allowed to have immediately a nested group.

#12 Updated by Sandro Santilli over 6 years ago

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

You didn't understand. What you describe is still possible.
Anyway I fixed what I meant with 7344368abefb149c05868c23cb0774b17653ea67

Please reopen if anything else is still missing

#13 Updated by Giovanni Manghi over 6 years ago

if I understand well

Also available in: Atom PDF