<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Nathan,<br>
    <br>
    Thanks for your reply.<br>
    I am a little bit confused as I do not really know how to set the
    mouse position. I have a solution, but it is not giving the same
    experience as when you create a new feature in a layer:<br>
    <br>
    I use the canvasMoveEvent, I get the point in pixels in the canvas
    using&nbsp; <br>
    &nbsp;&nbsp; result,snappingResults =
    QgsMapCanvasSnapper(self.canvas).snapToBackgroundLayers(pixPoint,[])<br>
    <br>
    The best I could do is calculating the difference in pixels:<br>
    &nbsp;&nbsp;&nbsp; self.transform = self.canvas.getCoordinateTransform()<br>
    &nbsp;&nbsp;&nbsp; snappedPoint = QgsPoint(snappingResults[0].snappedVertex)&nbsp;&nbsp;&nbsp; <br>
    &nbsp;&nbsp;&nbsp; startPoint =
    self.transform.toMapCoordinates(pixPoint.x(),pixPoint.y())<br>
    &nbsp;&nbsp;&nbsp; dx&nbsp; =
    (snappedPoint.x()-startPoint.x())/self.transform.mapUnitsPerPixel()<br>
    &nbsp;&nbsp;&nbsp; dy&nbsp; =
    (snappedPoint.y()-startPoint.y())/self.transform.mapUnitsPerPixel()<br>
    <br>
    And then setting the cursor by applying this difference:<br>
    &nbsp;&nbsp;&nbsp; qcur = QCursor.pos()<br>
    &nbsp;&nbsp;&nbsp; QCursor().setPos(qcur.x()+dx,qcur.y()-dy)<br>
    <br>
    I am quite sure there is a smarter way, but I cannot find it!<br>
    Also the problem is that the mouse is oscillating using this method.
    The only reason I can give is that canvasMoveEvent is sent again
    before the previously called method has returning, could it be true?<br>
    <br>
    I am a little bit lost in this. I would really appreciate your help!<br>
    <br>
    Thanks again,<br>
    <br>
    Denis<br>
    <br>
    <br>
    <br>
    <br>
    On 02/03/2012 07:37 AM, Nathan Woodrow wrote:
    <blockquote
cite="mid:CAAi8Yg9zY_C_VWfBjWhTx=8ru3o6Z+J0WcF3FKG8YpFT1jyMGw@mail.gmail.com"
      type="cite">Hey Denis,
      <div><br>
      </div>
      <div><span class="Apple-style-span"
          style="background-color:rgb(255,255,255)">The QCursor&nbsp;<span
            class="Apple-style-span"
            style="color:rgb(54,53,52);line-height:13px"><span
style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px"><a
                moz-do-not-send="true"
                href="http://developer.qt.nokia.com/doc/qt-4.8/qcursor.html#setPos"
                style="font-size:11px;font-weight:bold;font-family:Verdana,'DejaVu
Sans',Geneva,sans-serif;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;color:rgb(0,115,47);text-decoration:none">setPos</a><font
                class="Apple-style-span" face="arial, helvetica,
                sans-serif"><span class="Apple-style-span"
                  style="font-size:11px">&nbsp; </span>methods are static so
                you shouldn't need to get access to the instance to move
                the cursor position.</font></span></span></span></div>
      <div><font class="Apple-style-span" face="Verdana, 'DejaVu Sans',
          Geneva, sans-serif" color="#363534"><span
            class="Apple-style-span"
            style="font-size:11px;line-height:13px"><b><br>
            </b></span></font></div>
      <div><font class="Apple-style-span" face="Verdana, 'DejaVu Sans',
          Geneva, sans-serif" color="#363534"><span
            class="Apple-style-span"
            style="font-size:11px;line-height:13px"><b>- Nathan<br>
            </b></span></font><br>
        <div class="gmail_quote">On Fri, Feb 3, 2012 at 4:07 PM, Denis
          Rouzaud <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:denis.rouzaud@gmail.com">denis.rouzaud@gmail.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            Is there anyway to access the QCursor within
            QgsMapToolEmitPoint. I see there is a mCursor, but it's
            protected.</blockquote>
        </div>
        <br>
      </div>
    </blockquote>
  </body>
</html>