Opened 15 years ago
Closed 15 years ago
#1856 closed bug (fixed)
Improving Show/Hide all layers
Reported by: | gcarrillo | Owned by: | homann |
---|---|---|---|
Priority: | minor: annoyance | Milestone: | Version 1.2.0 |
Component: | Map Legend | Version: | Trunk |
Keywords: | show hide all layers legend canvas slow | Cc: | |
Must Fix for Release: | No | Platform: | All |
Platform Version: | Awaiting user input: | no |
Description
I think Show/Hide all layers are really slow methods (prove it with 4 or 5 heavy layers). The users can see every layer changing its state and consuming some time.
It is caused by multiple calls (one for each layer) to updateMapCanvasLayerSet method (QgsLegend class, selectAll slot). So one solution for this issue is: Set the state for the QTreeWidgetItems, set the state for the layers and finally call the updateMapCanvasLayerSet method.
I did this on a python app and get evident results (even faster than QGis :D), but my app is simple, I don't have layer groups or layer files. I don't understand how to manage them so, please try this in QgsLegend.
If you want I can make a screencast to show the difference.
Here is my Python code:
self.blockSignals( True )
status = Qt.Checked if select else Qt.Unchecked
for i in range( self.topLevelItemCount() ):
self.topLevelItem( i ).setCheckState( 0, status )
self.topLevelItem( i ).canvasLayer.setVisible( select )
self.blockSignals( False )
self.updateLayerSet() # Finally, update the layer set
Change History (2)
comment:1 by , 15 years ago
Owner: | changed from | to
---|
comment:2 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in r11263. Turned off rendering instead of blocking signals :-) Thanks for the idea.
Hi!
homann is working on changes in the legend gui (see #1815), so he may be interested in this ticket and should be able to help.