[Qgis-developer] QGIS plugin : connect to polygonselect Maptool signals
Cev Hillan
cevhillan at gmail.com
Fri Mar 20 03:33:05 PDT 2015
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150320/88dcc125/attachment.html>
More information about the Qgis-developer
mailing list