Feature request #6655

topoviewer: use QgsMapCanvasLayer to load layers with visibility=off

Added by Sandro Santilli about 12 years ago. Updated about 12 years ago.

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

Description

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)

History

#1 Updated by Giuseppe Sucameli about 12 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

iface.mapCanvas().setRenderFlag(False)
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 about 12 years ago

Those calls are already there.

#3 Updated by Sandro Santilli about 12 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 about 12 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