Hello to all !

Working on a new QGIS plugin I am trying to connect a custom function to the mouse right-clic signal, while using the polygon select maptool.

I have activated the maptool through :

|def  run(self):
    self.iface.actionSelectPolygon().trigger()|

And would now like to connect my selectSite function to a canvasReleaseEvent or similar signal. From an interesting tutorial here <http://www.qgisworkshop.org/html/workshop/plugins_tutorial.html> I adapted the code and tried the line below which failed :

|def  run(self):
    self.iface.actionSelectPolygon().trigger()
    result=  QObject.connect(self.canvas.mapTool(),  
SIGNAL("canvasReleaseEvent()"),  self.selectSite)

def  selectSite(self):
    QMessageBox.information(  self.iface.mainWindow(),"Info",  "in selectSite 
function"  )|

Any ideas or hints on how I can achieve my goal ?

I understand I could reimplement my own polygon selecting tool and customize it, but it seems like an overkill and am looking for something simpler - if possible. Is there another way around by connecting to a more generic Qt mouse click signal sent by canvas or Qt ?

Thanks for help.

Cev.


_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to