<?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[QGraphicsView doesnt render properly?]]></title><description><![CDATA[<p dir="auto">I'm using the graphics framework (QGraphicsView, QGraphicsScene, QGraphicsEllipseItem, QGraphicsRectItem) to draw ellipses and rectangles in an area using the mouse (press, move, release) events. Just like happen when we use the MSPaint.</p>
<p dir="auto">To get mouse events, I created an class (GraphicsScene) that inherites of QGraphicsScene. When the user select and item to draw, lets say an ellipse, and click on draw area, I catch that first point (using mousepress event). When the user move the mouse I catch a second point, do some calculus to get the width and height of that rectangle, and use all those information in setRect method of QGraphicsEllipseItem.</p>
<p dir="auto">The following code, does that:</p>
<p dir="auto">@void GraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {<br />
...<br />
ellipse-&gt;setRect(ellipse-&gt;rect().x(), ellipse-&gt;rect().y(),<br />
event-&gt;scenePos().x() - ellipse-&gt;rect().x(),<br />
event-&gt;scenePos().y() - ellipse-&gt;rect().y());<br />
...@</p>
<p dir="auto">Everything works fine with ellipse. The problem is when I use the same idea to draw and rectangle.</p>
<p dir="auto">When I draw a rectangle, from up-left to down-right, it works fine, but if I tray any other direction for example from down to up (no matter if is right or left) the rectangle drawed doesnt appear (look Image1), just appear an line! But if in the next I draw something on top of it, that rectangle that was only a line, appears normally (look Image2).</p>
<p dir="auto">Image 1<br />
!<a href="http://i.imgur.com/dQ8bD9n.png" target="_blank" rel="noopener noreferrer nofollow ugc">http://i.imgur.com/dQ8bD9n.png</a>(Image 1)!</p>
<p dir="auto">Image 2<br />
!<a href="http://i.imgur.com/qxp737G.png" target="_blank" rel="noopener noreferrer nofollow ugc">http://i.imgur.com/qxp737G.png</a>(Image 2)!</p>
<p dir="auto">I tried to draw the rectangle with a lot of other ways like: setting the top-left and bottom-right points, setting all corner points, and so on... but nothing works!</p>
<p dir="auto">I'm thinking that probably is a Qt's bug, because the same idea works in a ellipse, but not with rectangles!</p>
<p dir="auto">Please guys, what am I doing wrong?</p>
<p dir="auto">I'm using Qt 5 on Kubuntu, but have tried on latest Qt's version on Win7 and the problem is the same.</p>
]]></description><link>https://forum.qt.io/topic/31406/qgraphicsview-doesnt-render-properly</link><generator>RSS for Node</generator><lastBuildDate>Thu, 22 Oct 2026 21:48:44 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/31406.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 30 Aug 2013 17:00:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QGraphicsView doesnt render properly? on Sat, 31 Aug 2013 16:43:30 GMT]]></title><description><![CDATA[<p dir="auto">Hi soroush, thank you to reply.</p>
<p dir="auto">I've tried draw a valid rectangle, but without success. Probably because there is something wrong in my code.</p>
<p dir="auto">But as I said before, if I use the same idea to draw an ellipses, it works fine even with an invalid rectangle!</p>
]]></description><link>https://forum.qt.io/post/193555</link><guid isPermaLink="true">https://forum.qt.io/post/193555</guid><dc:creator><![CDATA[HelderC]]></dc:creator><pubDate>Sat, 31 Aug 2013 16:43:30 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsView doesnt render properly? on Sat, 31 Aug 2013 12:04:42 GMT]]></title><description><![CDATA[<p dir="auto">Hi Helder</p>
<p dir="auto">I would try to draw a valid rectangle instead. It should have positive height and width.</p>
]]></description><link>https://forum.qt.io/post/193534</link><guid isPermaLink="true">https://forum.qt.io/post/193534</guid><dc:creator><![CDATA[soroush]]></dc:creator><pubDate>Sat, 31 Aug 2013 12:04:42 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsView doesnt render properly? on Sat, 31 Aug 2013 00:05:03 GMT]]></title><description><![CDATA[<p dir="auto">Hi.</p>
<p dir="auto">Yes, I searched on bug report system, but I didnt found anything related to that.</p>
<p dir="auto">I'll follow your advice, thank you.</p>
]]></description><link>https://forum.qt.io/post/193507</link><guid isPermaLink="true">https://forum.qt.io/post/193507</guid><dc:creator><![CDATA[HelderC]]></dc:creator><pubDate>Sat, 31 Aug 2013 00:05:03 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsView doesnt render properly? on Fri, 30 Aug 2013 20:57:16 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">You could be indeed hitting a bug, did you try to look at the "bug report system":<a href="http://bugreports.qt-project.org/issues" target="_blank" rel="noopener noreferrer nofollow ugc">http://bugreports.qt-project.org/issues</a> to see if it's something known ? If not you could open a new report with a minimal compilable example to reproduce this</p>
]]></description><link>https://forum.qt.io/post/193494</link><guid isPermaLink="true">https://forum.qt.io/post/193494</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 30 Aug 2013 20:57:16 GMT</pubDate></item></channel></rss>