<?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 unprecise painting with raster engine]]></title><description><![CDATA[<p dir="auto">I have a QGraphicsView with multiple QGraphicsItems. The items draw a QPixmap into the boundingRect of the item and a black line on the border of the boundingRect. If I use the opengl painting engine the border is exactly where the image is painted. With raster engine there is (depending on the size of the graphics item) space between the drawn border and the drawn image. It looks like the sizes are calculated as integers and not as floats. Is there an option to set or a workaround for this painting errors ?</p>
]]></description><link>https://forum.qt.io/topic/304/qgraphicsview-unprecise-painting-with-raster-engine</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 15:15:46 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/304.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 20 Jul 2010 06:39:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QGraphicsView unprecise painting with raster engine on Tue, 20 Jul 2010 14:19:54 GMT]]></title><description><![CDATA[<p dir="auto">Atialiasing is false and I tried it with 0.0 and 1.0 pen width and it made no difference because the transformation is reseted.</p>
]]></description><link>https://forum.qt.io/post/53304</link><guid isPermaLink="true">https://forum.qt.io/post/53304</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Tue, 20 Jul 2010 14:19:54 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsView unprecise painting with raster engine on Tue, 20 Jul 2010 10:45:35 GMT]]></title><description><![CDATA[<p dir="auto">Did you try your original code with 0.0 pen and antialiasing disabled?</p>
]]></description><link>https://forum.qt.io/post/53281</link><guid isPermaLink="true">https://forum.qt.io/post/53281</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Tue, 20 Jul 2010 10:45:35 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsView unprecise painting with raster engine on Tue, 20 Jul 2010 09:08:54 GMT]]></title><description><![CDATA[<p dir="auto">I have a workaround for raster engine drawing of black rect with a small white border and deactivated Antialiasing.</p>
<p dir="auto">@<br />
qreal borderWidth = 1.0;<br />
painter-&gt;setPen(Qt::NoPen);<br />
painter-&gt;setBrush(Qt::white);<br />
painter-&gt;drawRects(rect);<br />
painter-&gt;setBrush(Qt::black);<br />
painter-&gt;drawRects(rect.adjusted(borderWidth, borderWidth, -borderWidth, -borderWidth));<br />
@</p>
]]></description><link>https://forum.qt.io/post/53276</link><guid isPermaLink="true">https://forum.qt.io/post/53276</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Tue, 20 Jul 2010 09:08:54 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsView unprecise painting with raster engine on Tue, 20 Jul 2010 08:42:50 GMT]]></title><description><![CDATA[<p dir="auto">Another thing is that the small rect with the white border is drawn like</p>
<p dir="auto">@<br />
painter-&gt;setPen(QPen(Qt::white, 0.0, Qt::SolidLine));<br />
painter-&gt;setBrush(Qt::black);<br />
painter-&gt;drawRect(...);<br />
@</p>
<p dir="auto">as you can see it isn't drawn exactly, too.</p>
]]></description><link>https://forum.qt.io/post/53275</link><guid isPermaLink="true">https://forum.qt.io/post/53275</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Tue, 20 Jul 2010 08:42:50 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsView unprecise painting with raster engine on Tue, 20 Jul 2010 07:51:19 GMT]]></title><description><![CDATA[<p dir="auto">Hmm the selectionRect is correctly calculated. It must have to do something with pixmap drawing.</p>
]]></description><link>https://forum.qt.io/post/53269</link><guid isPermaLink="true">https://forum.qt.io/post/53269</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Tue, 20 Jul 2010 07:51:19 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsView unprecise painting with raster engine on Tue, 20 Jul 2010 07:33:41 GMT]]></title><description><![CDATA[<p dir="auto">Thank you ! I think I have an error where the selectionRect is calculated.</p>
]]></description><link>https://forum.qt.io/post/53266</link><guid isPermaLink="true">https://forum.qt.io/post/53266</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Tue, 20 Jul 2010 07:33:41 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsView unprecise painting with raster engine on Tue, 20 Jul 2010 07:22:51 GMT]]></title><description><![CDATA[<p dir="auto">I have seen this problem too. You're using size 1.0 pen width, but zooming the viewport scales this too. If one pixel border line is ok, try using 0.0 pen.</p>
]]></description><link>https://forum.qt.io/post/53265</link><guid isPermaLink="true">https://forum.qt.io/post/53265</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Tue, 20 Jul 2010 07:22:51 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsView unprecise painting with raster engine on Tue, 20 Jul 2010 07:17:58 GMT]]></title><description><![CDATA[<p dir="auto">I'am zooming the viewport and the drawn rect should be drawn everytime with the same width in every zoom level. This item can be moved and resized, the inaccurate painting is only done in some zoom - size relations.<br />
@<br />
// draw the pixmap<br />
painter-&gt;drawPixmap(dataItem()-&gt;rect(), pixmap)</p>
<p dir="auto">painter-&gt;setPen(QPen(Qt::black, 1.0, Qt::DashLine));<br />
// reset the transformation<br />
QTransform t(painter-&gt;transform());<br />
painter-&gt;resetTransform();<br />
// get the rect to draw without transformation<br />
QPolygonF selectedPolygon = t.map(selectedRect);<br />
painter-&gt;drawPolygon(selectedPolygon);</p>
<p dir="auto">// draw some other untransformed stuff<br />
...<br />
@</p>
<p dir="auto">I thought it is some kind of rounding problem, but with opengl it is exactly this code and it works.<br />
This is how it looks<br />
!<a href="http://img844.imageshack.us/img844/9009/bildschirmfoto20100720u.png(example)" target="_blank" rel="noopener noreferrer nofollow ugc">http://img844.imageshack.us/img844/9009/bildschirmfoto20100720u.png(example)</a>!</p>
]]></description><link>https://forum.qt.io/post/53264</link><guid isPermaLink="true">https://forum.qt.io/post/53264</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Tue, 20 Jul 2010 07:17:58 GMT</pubDate></item><item><title><![CDATA[Reply to QGraphicsView unprecise painting with raster engine on Tue, 20 Jul 2010 06:54:03 GMT]]></title><description><![CDATA[<p dir="auto">Are you zooming the viewport and what is the pen width you're using for the rectangle? Are you moving the item or is it static? Can you give an example?</p>
]]></description><link>https://forum.qt.io/post/53260</link><guid isPermaLink="true">https://forum.qt.io/post/53260</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Tue, 20 Jul 2010 06:54:03 GMT</pubDate></item></channel></rss>