[GIS] Does mapCanvas().refresh() not work in QGIS 2.6

pyqgispythonqgisqgis-2.6

Before I used the function

qgis.utils.iface.mapCanvas().refresh()

to reload the map canvas after for example a layer color was changed from a plugin.
But this is not working with QGIS 2.6 for me.
Do I have to use another function to refresh the map canvas or is this a bug?

Best Answer

It may very well be a bug as I also cannot get the canvas to refresh. You can try the following as a workaround:

myLayer.triggerRepaint()

To refresh all layers following function can be used:

def refresh_layers(self):
    for layer in qgis.utils.iface.mapCanvas().layers():
        layer.triggerRepaint()
Related Question