<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Mouse tracking on QGraphicsView]]></title><description><![CDATA[<p dir="auto">Hello!</p>
<p dir="auto">I have a class derivated of QGraphicsView. I had to enable the mouse tracking property because I have to get the mouse position coordinates. Now, the problem is that when I move the mouse on the QGraphicsView, I can move the image inside "without clicking it".</p>
<p dir="auto">How could I disable this first click?</p>
]]></description><link>https://forum.qt.io/topic/78628/mouse-tracking-on-qgraphicsview</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 01:25:55 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/78628.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 26 Apr 2017 08:10:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Mouse tracking on QGraphicsView on Mon, 05 Jun 2017 07:22:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dheerendra">@<bdi>dheerendra</bdi></a> Yes, exactly, this is my problem. Thank you for translate my question haha.</p>
]]></description><link>https://forum.qt.io/post/397304</link><guid isPermaLink="true">https://forum.qt.io/post/397304</guid><dc:creator><![CDATA[ivanicy]]></dc:creator><pubDate>Mon, 05 Jun 2017 07:22:06 GMT</pubDate></item><item><title><![CDATA[Reply to Mouse tracking on QGraphicsView on Fri, 02 Jun 2017 14:02:06 GMT]]></title><description><![CDATA[<p dir="auto">Let me rephrase your question. You have QGraphicsView &amp; inside the You have image with GraphicsItem. Based on the mouse click you would like to move the image. Since you have enabled mouse tracking, without clicking also image is moving. Is that the correct problem statement ?<br />
If yes, you would like do something like, without first click image should not move. Is that correct ?</p>
]]></description><link>https://forum.qt.io/post/397027</link><guid isPermaLink="true">https://forum.qt.io/post/397027</guid><dc:creator><![CDATA[dheerendra]]></dc:creator><pubDate>Fri, 02 Jun 2017 14:02:06 GMT</pubDate></item><item><title><![CDATA[Reply to Mouse tracking on QGraphicsView on Fri, 02 Jun 2017 11:57:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dheerendra">@<bdi>dheerendra</bdi></a> This is my code section:</p>
<pre><code>    /* MODO POR DEFECTO (ZOOM) ****************************************************************************** */
    if (graphicMode == ZOOM_MODE) {
    //if (sceneMode == NoMode) {
        QPointF pos = this-&gt;mapToScene(event-&gt;pos());
        int _posX = pos.x();
        int _posY = pos.y();
        if (this-&gt;hasMouseTracking() &amp;&amp; !item-&gt;pixmap().isNull()) {
            if (_posX &gt;= 0 &amp;&amp; _posX &lt;= this-&gt;imageData.cols &amp;&amp; _posY &gt;= 0 &amp;&amp; _posY &lt;= this-&gt;imageData.rows)
                if (analysisMode)
                    emit sendPos(this-&gt;mapToScene(event-&gt;pos()), this-&gt;imageTemp.ptr&lt;double&gt;(_posY)[_posX]);/************/
                else emit sendPos(this-&gt;mapToScene(event-&gt;pos()), asignaTemperatura(C1*(double)this-&gt;imageData.ptr&lt;short&gt;(event-&gt;pos().y())[event-&gt;pos().x()] + C0, 1, tabla_L_T1));
            else {
                QPoint badPos(-1,-1);
                emit sendPos(badPos, -1);
            }
        }
        if (_pan)
        {
            horizontalScrollBar()-&gt;setValue(horizontalScrollBar()-&gt;value() - (event-&gt;x() - _panStartX));
            verticalScrollBar()-&gt;setValue(verticalScrollBar()-&gt;value() - (event-&gt;y() - _panStartY));
            _panStartX = event-&gt;x();
            _panStartY = event-&gt;y();
            event-&gt;accept();
            return;
        }

        event-&gt;ignore();
    }
</code></pre>
<p dir="auto">Thank you very much!</p>
]]></description><link>https://forum.qt.io/post/396998</link><guid isPermaLink="true">https://forum.qt.io/post/396998</guid><dc:creator><![CDATA[ivanicy]]></dc:creator><pubDate>Fri, 02 Jun 2017 11:57:20 GMT</pubDate></item><item><title><![CDATA[Reply to Mouse tracking on QGraphicsView on Wed, 26 Apr 2017 12:45:23 GMT]]></title><description><![CDATA[<p dir="auto">If image moves means u must be setting image coordinates with mouse move coordinates. Can u paste the sample code ?</p>
]]></description><link>https://forum.qt.io/post/390067</link><guid isPermaLink="true">https://forum.qt.io/post/390067</guid><dc:creator><![CDATA[dheerendra]]></dc:creator><pubDate>Wed, 26 Apr 2017 12:45:23 GMT</pubDate></item><item><title><![CDATA[Reply to Mouse tracking on QGraphicsView on Wed, 26 Apr 2017 11:30:07 GMT]]></title><description><![CDATA[<p dir="auto">Thank you very much for answer me but this fix doesn't work. The problem is: at first, when I move the mouse, the image moves too, but, when I click the image, the movement stops, and I want to stop the movement always.</p>
]]></description><link>https://forum.qt.io/post/390055</link><guid isPermaLink="true">https://forum.qt.io/post/390055</guid><dc:creator><![CDATA[ivanicy]]></dc:creator><pubDate>Wed, 26 Apr 2017 11:30:07 GMT</pubDate></item><item><title><![CDATA[Reply to Mouse tracking on QGraphicsView on Wed, 26 Apr 2017 11:26:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ivanicy">@<bdi>ivanicy</bdi></a></p>
<p dir="auto">Try setting to false,l <a href="http://doc.qt.io/qt-4.8/qgraphicsitem.html#GraphicsItemFlag-enum" target="_blank" rel="noopener noreferrer nofollow ugc">setflag()</a></p>
<pre><code>setFlag(QGraphicsItem::ItemIsMovable, false);
</code></pre>
]]></description><link>https://forum.qt.io/post/390050</link><guid isPermaLink="true">https://forum.qt.io/post/390050</guid><dc:creator><![CDATA[Ni.Sumi]]></dc:creator><pubDate>Wed, 26 Apr 2017 11:26:32 GMT</pubDate></item></channel></rss>