Bug report #11382
TopoViewer: all layers are added as visible while code asks them NOT to be
|Affected QGIS version:||2.4.0||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||19669|
I guess something changed in the TOC api as the TopoViewer plugin of the DBManager now adds all layers as visible even if it makes its best to request then NOT to be.
# NODES group = legend.addGroup(u'Nodes', False, supergroup) # should not be needed: #6938 legend.setGroupVisible(group, False) layer = QgsVectorLayer(uri.uri(), u'%s.node' % toponame, provider) registry.addMapLayers([layer]) legend.setLayerVisible(layer, False) legend.setLayerExpanded(layer, False) legend.moveLayer(layer, group)
[TopoViewer] fix layer visibility after QgsLegendInterface API changes
It was broken with 2.4, whereas QgsLegendInterface::moveLayer started
forcing layer visibility on (undocumented behaviour).
#1 Updated by Sandro Santilli about 6 years ago
- Affected QGIS version changed from master to 2.4.0
It looks like 2.4 was also affected :(
#6 Updated by Sandro Santilli about 6 years ago
Thank you Gillian, the change fixes the problem. But as of version 2.2 the behaviour was different.
Also, the API documentation doesn't say anything about moveLayer making the layer visible:
#8 Updated by Salvatore Larosa about 6 years ago
I would reopen this issue as the
moveLayer should not make the layer visible if it was not.
IMO, the normal behavior when moving a layer into a group is keeping the initial state of the layer.
here my proposal patch: https://github.com/qgis/QGIS/pull/1629
I also think you can drop all the stuff like "should not be needed: #6938" from topoviewer plugin :)
#11 Updated by Sandro Santilli about 6 years ago
Thanks, Martin. Could you also look at #6938 since you're at it ? Would be nice to drop other hacks from the plugin, like