Thanks qgis 2, the Legend Interface (layers dockwidget) now has Update Drawing Order check box on right-click mouse context menu. I think this feature can let user temporally closes rendering, then changes order of layers without no-used rendering.
And how to use PyQGIS control this feature??

Btw, the PyQGIS API iface.legendInterface().moveLayer( layer, group_index )
in qgis, group_index include any layer and group (on top level?), but
in qgis2, group_index just include group

e.g. If the layer/group structure:


To move layer1 to group 1
in qgis, use qgis.utils.iface.legendInterface().moveLayer( layer1, 1 )
in qgis2, use iface.legendInterface().moveLayer( layer1, 0 )

I use moveLayer, but mapCanvas doesn't refresh, even I use mapCanvas.refresh()

iface.legendInterface().moveLayer( iface.activeLayer(), 0) # activeLayer move to top of gruop in layer legend, but mapCanvas doesn't refresh
iface.mapCanvas().refresh() #nothing happened

But I uncheck and then check Update Drawing Order, it works.
How could I refresh mapCanvas after layer moved??
If I can use PyQGIS to uncheck and check Update Drawing Order, it will work.

  • Update Drawing Order is used to tell QGIS if it should let the legend or the Layer Order dialog control the rendering order of layers.
    – Nathan W
    Commented Jan 16, 2014 at 3:49
  • Thank you for correcting me :). When Update Drawing Order is unchecked, I still can use PyQGIS API to do rendering.
    – SCKU
    Commented Jan 16, 2014 at 4:07
  • I don't really know what you are asking.
    – Nathan W
    Commented Jan 16, 2014 at 4:08
  • Sorry, I think when I use moveLayer(), QGIS will rendering for me, but now I tested, It's not. I want to save rendering time, e.g. I want to 1. add new layer 2. move some layers to group 3. rendering
    – SCKU
    Commented Jan 16, 2014 at 4:25

1 Answer 1


To stop rendering you need to call:


then to undo:

  • Thanks, I think I can use this concept when add some layers without rendering each steps.
    – SCKU
    Commented Jan 16, 2014 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.