<div>Hi,<br><br>I'm currently trying to overload the canvasPressEvent
from QgsMapTool in my plugin but it doesn't work, did i forgot anything
in my code??&nbsp; I put a message box when the mouse is clicked on the
canvas but I never get the message.&nbsp; Is it the constructor and i don't
initialize the QgsMapTool correctly??
<br><br>/***************** plugin.h<br><br>[...]<br>#include &lt;qgsmaptool.h&gt;<br>[...]<br>class plugin : public QObject, public QgisPlugin, public QgsMapTool {<br>&nbsp;&nbsp;&nbsp; Q_OBJECT;<br>&nbsp;&nbsp;&nbsp; public:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; virtual ~plugin();
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; plugin(QgisApp * theApplication, QgisIface * theInterface);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; virtual void canvasPressEvent(QMouseEvent * e);<br>&nbsp;&nbsp;&nbsp; public slots:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; [...]<br>&nbsp;&nbsp;&nbsp; private:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; [...]<br><br>/***************** 
plugin.cpp<br><br>[...]<br>#include &quot;plugin.h&quot;<br>QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer) {<br>&nbsp;&nbsp;&nbsp; return new plugin(theQGisAppPointer, theQgisInterfacePointer);
<br>}<br>[...]<br>plugin::plugin(QgisApp * theQGisApp, QgisIface * theQgisInterface) : <br>&nbsp;&nbsp;&nbsp; QgisPlugin(sName,sDescription,sPluginVersion,sPluginType), <br>&nbsp;&nbsp;&nbsp; mQGisApp(theQGisApp), <br>&nbsp;&nbsp;&nbsp; mQGisIface(theQgisInterface),
<br>&nbsp;&nbsp;&nbsp; QgsMapTool(theQgisInterface-&gt;getMapCanvas())&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;---------------------------&nbsp; <br>{<br>&nbsp;&nbsp;&nbsp; /* do nothing */<br>}<br>[...]<br>void plugin::canvasPressEvent(QMouseEvent * e) {<br>&nbsp;&nbsp;&nbsp;
QMessageBox::critical(0, QString(&quot;SEARCH&quot;), QString(&quot;Cannot create
Search Window.&quot;), QMessageBox::Ok, QMessageBox::NoButton,
QMessageBox::NoButton);
<br>}<br>[...]</div><span class="q"><br><br>Thx a lot<br><br>Mathieu Ouimet</span>