Opened 14 years ago

Closed 13 years ago

#2150 closed bug (worksforme)

QgsMapCanvas.refresh() doesn't reload WMS layer

Reported by: trapanator Owned by: nobody
Priority: major: does not work as expected Milestone: Version 1.7.0
Component: MapCanvas Version: Trunk
Keywords: Cc:
Must Fix for Release: Yes Platform: Windows
Platform Version: Awaiting user input: no

Description

In a plugin I add a feature to a PostGIS layer. I have another WMS raster layer connected to this PostGIS layer.

If I invoke the command:

      QgsMapCanvas.refresh()

it refreshes the map but not the WMS layer. A workaround is this (note: 'e' variable is QMouseEvent type):

     self.myCanvas.panAction(e)
     self.myCanvas.panActionEnd(QPoint (e.x(), e.y()))

Change History (3)

comment:1 by pcav, 14 years ago

Milestone: Version 1.5.0Version 1.6.0

comment:2 by trapanator, 13 years ago

Milestone: Version 1.6.0Version 1.7.0

comment:3 by mhugent, 13 years ago

Resolution: worksforme
Status: newclosed

Try to reload the layers before refreshing the canvas (that's how qgisapp does it):

C++: QgsMapLayerRegistry::instance()->reloadAllLayers(); mMapCanvas->refresh();

Python: QgsMapLayerRegistry.instance().reloadAllLayers() qgis.utils.iface.mapCanvas().refresh()

Hope it works (otherwise reopen the ticket)

Note: See TracTickets for help on using tickets.