<?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[QGraphicsRectItem Mouse press event Problem!!!]]></title><description><![CDATA[<p dir="auto">i have a sub class of QgraphicsRectitem name "CLASS 1" , and  re implement the mousepress event on it;</p>
<p dir="auto">i also have a sub class of qgraphichscene  name "CLASS 2",and re implement the Mouse press event for it to ,<br />
and in the CLASS 2 i have some object of CLASS 1, (some rectitem in the Scene)<br />
Now, the problem is when i click on the Rect  in the scene !!! the Function of CLASS 2 , scene, is calling!!!<br />
but, i want to for example move or ... the RECT!!!!1<br />
what can i DO ?????<br />
so thank you!!</p>
]]></description><link>https://forum.qt.io/topic/24695/qgraphicsrectitem-mouse-press-event-problem</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Apr 2026 03:51:18 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/24695.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 28 Feb 2013 09:57:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QGraphicsRectItem Mouse press event Problem!!! on Sat, 02 Mar 2013 16:51:02 GMT]]></title><description><![CDATA[<p dir="auto">"Drag" doesn't necessarily mean move.  Think abstractly: a Drag is a user moving the graphics pointer (mouse) with a button down.  Your program can interpret that to mean "move" or "draw."</p>
<p dir="auto">When the user presses a mouse button and begins to move the mouse, it generates a dragBeginEvent (or something like that.) If it begins in a scene item, the framework dispatches it to the item's handler (through the default implementation of the scene's handler.) Otherwise, the event is probably ignored by the scene's handler (I'm not sure about this.)</p>
<p dir="auto">So if you want the user to be able to draw from anywhere, even from inside an item, you might need to write code in both item and scene handlers (reimplemented.)</p>
]]></description><link>https://forum.qt.io/post/168985</link><guid isPermaLink="true">https://forum.qt.io/post/168985</guid><dc:creator><![CDATA[bootchk]]></dc:creator><pubDate>Sat, 02 Mar 2013 16:51:02 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsRectItem Mouse press event Problem!!! on Fri, 01 Mar 2013 20:25:47 GMT]]></title><description><![CDATA[<p dir="auto">Calling super is calling the super function. For example:</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/void">@<bdi>void</bdi></a> Scene::mousePressEvent(QGraphicsSceneMouseEvent *event)<br />
{<br />
// Calling super<br />
QGraphicsScene::mousePressEvent(event);</p>
<pre><code>  qDebug()&lt;&lt;"Scene Clicked!";
</code></pre>
<p dir="auto">}@</p>
]]></description><link>https://forum.qt.io/post/168933</link><guid isPermaLink="true">https://forum.qt.io/post/168933</guid><dc:creator><![CDATA[Skyrpex]]></dc:creator><pubDate>Fri, 01 Mar 2013 20:25:47 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsRectItem Mouse press event Problem!!! on Fri, 01 Mar 2013 18:19:56 GMT]]></title><description><![CDATA[<p dir="auto">"call super" how can do that ? what's it's code? ,<br />
i can't find any thing in the DOC.</p>
<p dir="auto">Do you mean , when i want to drag an object, in the Scene handlers , Invoke the item's handlers manually?<br />
and when i suppose to draw on the scene , don't invoke that.</p>
<p dir="auto">yes? Do i get True?</p>
]]></description><link>https://forum.qt.io/post/168918</link><guid isPermaLink="true">https://forum.qt.io/post/168918</guid><dc:creator><![CDATA[erfan71]]></dc:creator><pubDate>Fri, 01 Mar 2013 18:19:56 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsRectItem Mouse press event Problem!!! on Fri, 01 Mar 2013 10:59:17 GMT]]></title><description><![CDATA[<p dir="auto">In your scene handler, call super.  That dispatches and invokes the handler for the item.  When that handler returns, the scene handler continues executing.</p>
<p dir="auto">Drag is already supported by the "framework":<a href="http://harmattan-dev.nokia.com/docs/library/html/qt4/graphicsview.html#drag-and-drop" target="_blank" rel="noopener noreferrer nofollow ugc">http://harmattan-dev.nokia.com/docs/library/html/qt4/graphicsview.html#drag-and-drop</a>.  You don't need to handle mousePressEvent to get drag and drop events.  You need to interpret drag and drop events to mean to the user: move items (or create item, whatever you want it to mean.)</p>
]]></description><link>https://forum.qt.io/post/168860</link><guid isPermaLink="true">https://forum.qt.io/post/168860</guid><dc:creator><![CDATA[bootchk]]></dc:creator><pubDate>Fri, 01 Mar 2013 10:59:17 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsRectItem Mouse press event Problem!!! on Fri, 01 Mar 2013 05:06:29 GMT]]></title><description><![CDATA[<p dir="auto">ok, but i want that !!!<br />
i want to  draw shapes  on the scene , and i  want to  Drag and move the shapes that i was drawn  on the scene , How can I do that ?????? how can i receive event separately ?</p>
]]></description><link>https://forum.qt.io/post/168808</link><guid isPermaLink="true">https://forum.qt.io/post/168808</guid><dc:creator><![CDATA[erfan71]]></dc:creator><pubDate>Fri, 01 Mar 2013 05:06:29 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsRectItem Mouse press event Problem!!! on Thu, 28 Feb 2013 22:18:11 GMT]]></title><description><![CDATA[<p dir="auto">The default mousePressEvent() handler for QGraphicsScene dispatches to items in the scene.  Since you have reimplemented the default, without calling super, no dispatch is done.</p>
<p dir="auto">Event dispatching for widgets is different from event dispatching for the QGraphicsView framework: events first go to the view, then the scene, then items; seemingly the reverse of widgets.  But thats the default, and hidden, until you start reimplementing.</p>
]]></description><link>https://forum.qt.io/post/168800</link><guid isPermaLink="true">https://forum.qt.io/post/168800</guid><dc:creator><![CDATA[bootchk]]></dc:creator><pubDate>Thu, 28 Feb 2013 22:18:11 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsRectItem Mouse press event Problem!!! on Thu, 28 Feb 2013 10:18:52 GMT]]></title><description><![CDATA[<p dir="auto">this is my code:<br />
@class Scene : public QGraphicsScene{<br />
Scene(QGraphicsScene *parent = 0)<br />
{<br />
R=new Rect ;<br />
this-&gt;addItem(R);<br />
}<br />
void mousePressEvent(QGraphicsSceneMouseEvent *event)<br />
{<br />
qDebug()&lt;&lt;"Scene Clicked!";<br />
}<br />
}</p>
<p dir="auto">class Rect :public QObject, public  QGraphicsRectItem<br />
{<br />
void mousePressEvent(QGraphicsSceneMouseEvent *event)<br />
{<br />
qDebug()&lt;&lt;"Rect Clicked";<br />
}<br />
}</p>
<p dir="auto">@</p>
<p dir="auto">And when i clicked on the RECT item , print "Scene clicked" !!!!</p>
]]></description><link>https://forum.qt.io/post/168728</link><guid isPermaLink="true">https://forum.qt.io/post/168728</guid><dc:creator><![CDATA[erfan71]]></dc:creator><pubDate>Thu, 28 Feb 2013 10:18:52 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsRectItem Mouse press event Problem!!! on Thu, 28 Feb 2013 10:01:40 GMT]]></title><description><![CDATA[<p dir="auto">it will be better if u post your code ...</p>
]]></description><link>https://forum.qt.io/post/168722</link><guid isPermaLink="true">https://forum.qt.io/post/168722</guid><dc:creator><![CDATA[bepehr]]></dc:creator><pubDate>Thu, 28 Feb 2013 10:01:40 GMT</pubDate></item></channel></rss>