I'm writing a standalone QGIS Python app. I've subclassed QgsMapTool and have successfully implemented some selection capabilities. Now I'm trying to implement my own zoom behavior, using the same map tool, but QgsMapCanvas seems to have some built-in zooming behavior. How can disable the built-in zooming and get complete control over the mouse wheel?
class MyMapTool(QgsMapTool): ... def wheelEvent(self, event): new_extent = QgsRectangle(...) self.canvas.setExtent(new_extent) # Something else is messing with the extent. # How can I disable it and use my new_extent? # Set the tool to the canvas. This is the only Map Tool I use. tool = MyMapTool(self.canvas) self.canvas.setMapTool(tool)
[EDIT]: I'm using QGIS 2.18.