<?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[Solved:How to implement lastScenePos()?]]></title><description><![CDATA[<p dir="auto">Hi...<br />
according to Qt document:</p>
<p dir="auto">QPointF QGraphicsSceneMouseEvent::lastScenePos () const</p>
<p dir="auto">Returns the last recorded mouse cursor position in scene coordinates. The last recorded position is the position of the previous mouse event received by the view that created the event.</p>
<p dir="auto">I am not understand how to write it in application. Could you give me an example/suggestion how to write or implement this?</p>
<p dir="auto">Thank you.</p>
]]></description><link>https://forum.qt.io/topic/20874/solved-how-to-implement-lastscenepos</link><generator>RSS for Node</generator><lastBuildDate>Wed, 10 Jun 2026 17:57:45 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/20874.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 25 Oct 2012 05:32:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Solved:How to implement lastScenePos()? on Fri, 26 Oct 2012 02:58:30 GMT]]></title><description><![CDATA[<p dir="auto">Thank you very much issam and rcari. It's done well:<br />
@<br />
void MyItem::mousePressEvent(QGraphicsSceneMouseEvent *event)<br />
{<br />
if(event-&gt;button()==Qt::LeftButton){<br />
myMouse_koordinat = event-&gt;buttonDownScenePos<br />
(Qt::LeftButton);<br />
qDebug() &lt;&lt; myMouse_koordinat.x();<br />
}<br />
update();<br />
QGraphicsItem::mousePressEvent(event);<br />
}<br />
@</p>
]]></description><link>https://forum.qt.io/post/155448</link><guid isPermaLink="true">https://forum.qt.io/post/155448</guid><dc:creator><![CDATA[romeo.rbw]]></dc:creator><pubDate>Fri, 26 Oct 2012 02:58:30 GMT</pubDate></item><item><title><![CDATA[Reply to Solved:How to implement lastScenePos()? on Thu, 25 Oct 2012 11:52:21 GMT]]></title><description><![CDATA[<p dir="auto">I think it's better to use QGraphicsSceneMouseEvent::lastScenePos() inside one of those methods of the  QGraphicsScene class :</p>
<p dir="auto">@<br />
virtual void mouseDoubleClickEvent ( QGraphicsSceneMouseEvent * mouseEvent )<br />
virtual void mouseMoveEvent ( QGraphicsSceneMouseEvent * mouseEvent )<br />
virtual void mousePressEvent ( QGraphicsSceneMouseEvent * mouseEvent )<br />
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * mouseEvent )<br />
@</p>
<p dir="auto">so you have to reimplement them !</p>
]]></description><link>https://forum.qt.io/post/155391</link><guid isPermaLink="true">https://forum.qt.io/post/155391</guid><dc:creator><![CDATA[issam]]></dc:creator><pubDate>Thu, 25 Oct 2012 11:52:21 GMT</pubDate></item><item><title><![CDATA[Reply to Solved:How to implement lastScenePos()? on Thu, 25 Oct 2012 08:13:27 GMT]]></title><description><![CDATA[<p dir="auto">Well lastScenePos will only be provided if you are tracking the mouse: if it was clicked and dragged, or if you grabbed it. It will not be on the initial click.</p>
]]></description><link>https://forum.qt.io/post/155366</link><guid isPermaLink="true">https://forum.qt.io/post/155366</guid><dc:creator><![CDATA[rcari]]></dc:creator><pubDate>Thu, 25 Oct 2012 08:13:27 GMT</pubDate></item><item><title><![CDATA[Reply to Solved:How to implement lastScenePos()? on Thu, 25 Oct 2012 08:00:18 GMT]]></title><description><![CDATA[<p dir="auto">Yes, I mean how to use it because I try like this but the coordinate not detected, always zero. I use buttonDownScenePos</p>
<p dir="auto">@<br />
QPointF DialogApplication::get_koordinat_mouse_klik(){</p>
<pre><code>QPointF mouse_koordinat;
QEvent::Type type;
QGraphicsSceneMouseEvent mouseEvent(type);

//mouse_koordinat = mouseEvent.lastScenePos();
mouse_koordinat=   mouseEvent.buttonDownScenePos(Qt::LeftButton);


return mouse_koordinat;
</code></pre>
<p dir="auto">}<br />
@</p>
]]></description><link>https://forum.qt.io/post/155360</link><guid isPermaLink="true">https://forum.qt.io/post/155360</guid><dc:creator><![CDATA[romeo.rbw]]></dc:creator><pubDate>Thu, 25 Oct 2012 08:00:18 GMT</pubDate></item><item><title><![CDATA[Reply to Solved:How to implement lastScenePos()? on Thu, 25 Oct 2012 07:32:52 GMT]]></title><description><![CDATA[<p dir="auto">Could you explain your case? This event is generated by the QGraphicsView when it receives mouse events. You just have to use this method, you don't need to implement it: it's already done in Qt.</p>
]]></description><link>https://forum.qt.io/post/155348</link><guid isPermaLink="true">https://forum.qt.io/post/155348</guid><dc:creator><![CDATA[rcari]]></dc:creator><pubDate>Thu, 25 Oct 2012 07:32:52 GMT</pubDate></item></channel></rss>