Feature request #6655

topoviewer: use QgsMapCanvasLayer to load layers with visibility=off

Added by Sandro Santilli over 11 years ago. Updated over 11 years ago.

Assignee:Sandro Santilli
Category:DB Manager
Pull Request or Patch supplied:No Resolution:fixed
Easy fix?:No Copied to github as #:15832


When loading big topologies qgis still renders the layers as first thing, before we get a chance of setting visibility off.
This means you can enter the "PAL loop of death" (that is a situation in which labelling kill your CPU).

The PAL issue is not available at the moment (or I can't find it).
But I swear it's there (qgis still hasn't finished loading the project I asked it to open at least 2 minutes before I started writing this ticket)


#1 Updated by Giuseppe Sucameli over 11 years ago

How many layers do you load at the same time?
If more than one, consider to set the render flag to false before loading layers using

and then restore it when the process ends.
After loading each layer you can set it as invisible using
iface.legendInterface().setLayerVisible(vl, False)

#2 Updated by Sandro Santilli over 11 years ago

Those calls are already there.

#3 Updated by Sandro Santilli over 11 years ago

Ok one problem was that I did use the setVisibleFlag before adding to legend (for some layers).
This I'm going to fix right now.

But still I'll want to look at NatanW suggestion:
22:41 < NathanW> strk: you wrap it in a QgsMapCanvasLayer and set the visable flag
22:42 < NathanW> QgsMapCanvas take a list of QgsMapCanvasLayer in it's setLayerSet method

PAL is still killing me, but only when I click on the visibility checkbox :/
See #6656 for that one

#4 Updated by Sandro Santilli over 11 years ago

  • Resolution set to fixed
  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Ok I took a look and setLayerSet seems to be for replacing the whole layer set. Not something I want to do here.
So this is closed.

Also available in: Atom PDF