<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"var\(--ff-mono\)";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:inherit;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">I found <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<pre style="vertical-align:baseline"><span style="font-family:"var(--ff-mono)",serif">QgsMapToolEmitPoint</span><span style="font-family:"inherit",serif;border:none windowtext 1.0pt;padding:0in"> , QgsMapTool</span><span style="font-family:"var(--ff-mono)",serif"> and </span><code><span style="font-family:"inherit",serif;border:none windowtext 1.0pt;padding:0in">canvas.setMapTool(…)<o:p></o:p></span></code></pre>
<pre style="vertical-align:baseline"><code><span style="font-family:"inherit",serif;border:none windowtext 1.0pt;padding:0in"><o:p> </o:p></span></code></pre>
<p class="MsoNormal" style="vertical-align:baseline"><code><span style="font-size:10.0pt;font-family:"inherit",serif;border:none windowtext 1.0pt;padding:0in">So I declared my class as
</span></code><span style="font-size:10.0pt;font-family:"var(--ff-mono)",serif">AoiSizeValidator(QgsMapToolEmitPoint)<o:p></o:p></span></p>
<pre style="vertical-align:baseline"><code><span style="font-family:"inherit",serif;border:none windowtext 1.0pt;padding:0in"><o:p> </o:p></span></code></pre>
<pre style="vertical-align:baseline"><code><span style="font-family:"inherit",serif;border:none windowtext 1.0pt;padding:0in">But gave that a try and it gets me x,y, initially but when I select an add layer from the qgis edit menu, I guess it sets a new map tool so mine gets overridden.  So looks like I need a different approach to get xy from the map canvas. </span></code><span style="font-family:"var(--ff-mono)",serif"><o:p></o:p></span></pre>
<p class="MsoNormal" style="vertical-align:baseline"><span style="font-size:10.0pt;font-family:"var(--ff-mono)",serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> QGIS-Developer <qgis-developer-bounces@lists.osgeo.org>
<b>On Behalf Of </b>Catania, Luke A ERDC-RDE-GRL-VA CIV via QGIS-Developer<br>
<b>Sent:</b> Wednesday, April 5, 2023 11:27 AM<br>
<b>To:</b> qgis-developer@lists.osgeo.org<br>
<b>Subject:</b> [QGIS-Developer] Detect a Map Canvas Mouse Event<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Trying to get a map canvas event when canvas is clicked and mouse is dragged.  I have code that creates an empty layer, but I use the QGIS edit menu to add the actually layer.  I want to be able to track the mouse movement so I can calculated
 the area of the feature being drawn in real time so I can make sure the area is within a defined range. 
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is there an event I can connect to so I can run my custom code when the even occurs?<o:p></o:p></p>
</div>
</body>
</html>