[Qgis-developer] Developing a custom PyQGIS desktop application

Pablo Carreira pablotcarreira at hotmail.com
Sat Jun 18 10:41:29 EDT 2011


> but the connect function doesn't seem to
> emit the point or call the slot.  Here is some sample code:
> 
> emitPoint = qgis.gui.QgsMapToolEmitPoint(w.canvas)
> w.canvas.setMapTool(emitPoint)
> w.connect(emitPoint, PyQt4.QtCore.SIGNAL("canvasClicked(QgsPoint)"),
> printHello)
> 
> Bob

Hi Bob,Here is an working connection that I use in one of my plugins:

self.point=gui.QgsMapToolEmitPoint(self.canvas)QObject.connect(self.point, SIGNAL("canvasClicked(const QgsPoint &,Qt::MouseButton)"), self.export)

Pay attention to "canvasClicked(const QgsPoint &,Qt::MouseButton)" it has to be exactly like that otherwise you will get no signal.
Regards,
Pablo. 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20110618/d96a44b6/attachment.html


More information about the Qgis-developer mailing list