[QGIS-trac] Re: [Quantum GIS] #2492: Legend fails to update when
layer visibility is changed during QgsMapCanvas::setLayerSet
Quantum GIS
qgis at qgis.org
Thu Mar 11 08:20:28 EST 2010
#2492: Legend fails to update when layer visibility is changed during
QgsMapCanvas::setLayerSet
-----------------------------------------------------+----------------------
Reporter: audun | Owner: mhugent
Type: patch | Status: new
Priority: major: does not work as expected | Milestone: Version 1.5.0
Component: Map Legend | Version: HEAD
Resolution: | Keywords:
Platform_version: | Platform: All
Must_fix: No | Status_info: 0
-----------------------------------------------------+----------------------
Comment (by audun):
It works, but here's some code that proves it.
{{{
from qgis.utils import iface
from qgis.gui import QgsMapCanvasLayer
from ftools_utils import getMapLayerByName
iface.mapCanvas().setLayerSet([])
}}}
Now all layers are turned off.
{{{
iface.mapCanvas().setLayerSet([QgsMapCanvasLayer(getMapLayerByName("layer1"))])
}}}
Now layer1 will be turned on, and the group it was in would be partially
checked. Note: If there are no layers called "layer1", bug #2543 will be
triggered.
--
Ticket URL: <http://trac.osgeo.org/qgis/ticket/2492#comment:4>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats
More information about the QGIS-trac
mailing list