<?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[QtPen draw wrong border for Rectangle (PyQt)]]></title><description><![CDATA[<p dir="auto">Hello everyone!<br />
I try to draw the Rectangle:<br />
@paint.setBrush(QtGui.QBrush(some gradient))<br />
paint.setPen(QtGui.QPen(QtGui.QColor("black"), 1))<br />
paint.drawRect(x, y, width, height)<br />
@<br />
as the result, this:</p>
<p dir="auto">!<a href="http://i60.tinypic.com/rhs8z5.jpg(sample)" target="_blank" rel="noopener noreferrer nofollow ugc">http://i60.tinypic.com/rhs8z5.jpg(sample)</a>!</p>
<p dir="auto">Why QPen border on top and on right side are shifted?<br />
left and bottom border correct</p>
]]></description><link>https://forum.qt.io/topic/46837/qtpen-draw-wrong-border-for-rectangle-pyqt</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Apr 2026 13:35:51 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/46837.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 09 Oct 2014 08:55:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QtPen draw wrong border for Rectangle (PyQt) on Fri, 17 Oct 2014 12:34:36 GMT]]></title><description><![CDATA[<p dir="auto">At last I understood myself (((<br />
The problem occurs only if I'm trying to set (draw) a rectangle height from bottom to top using a negative value (drawRect(0, 0, 20, -100)).<br />
If I set (draw) from top to bottom (drawRect(0, 0, 20, 100)) the rectangle looks perfect with no shifts.<br />
Whyyyyyyyyyyyyyyyyyyyy???????????</p>
]]></description><link>https://forum.qt.io/post/247977</link><guid isPermaLink="true">https://forum.qt.io/post/247977</guid><dc:creator><![CDATA[Buccaneer]]></dc:creator><pubDate>Fri, 17 Oct 2014 12:34:36 GMT</pubDate></item><item><title><![CDATA[Reply to QtPen draw wrong border for Rectangle (PyQt) on Fri, 10 Oct 2014 05:24:29 GMT]]></title><description><![CDATA[<p dir="auto">Qt - 4.8.4<br />
PyQt - 4.9.6<br />
Windows 7</p>
<p dir="auto">As for you <em>SGaist</em> my friend, code as he is:<br />
@<br />
class Chart(QtGui.QWidget):<br />
def <strong>init</strong>(self, parent=None):<br />
super(Chart, self).<strong>init</strong>(parent)<br />
def paintEvent(self, Event):<br />
paint = QtGui.QPainter(self)<br />
paint.setBrush(QtGui.QColor("#808080"))<br />
paint.drawRect(40, 20, 580, 410)<br />
paint.setPen(QtGui.QPen(QtGui.QColor("#ffffff"), 1))<br />
grad = QtGui.QLinearGradient(0, 20, 0, 410)<br />
grad.setColorAt(0.0, QtGui.QColor("#fefdc5"))<br />
grad.setColorAt(1.0, QtGui.QColor("#f3c169"))<br />
paint.setBrush(QtGui.QBrush(grad))<br />
paint.drawRect(70, 430, 25, -100)<br />
@</p>
<p dir="auto">I hope this will help</p>
]]></description><link>https://forum.qt.io/post/246908</link><guid isPermaLink="true">https://forum.qt.io/post/246908</guid><dc:creator><![CDATA[Buccaneer]]></dc:creator><pubDate>Fri, 10 Oct 2014 05:24:29 GMT</pubDate></item><item><title><![CDATA[Reply to QtPen draw wrong border for Rectangle (PyQt) on Thu, 09 Oct 2014 23:26:59 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">You should give more information, like the complete painting code, PyQt/Qt/OS you are using.</p>
]]></description><link>https://forum.qt.io/post/246894</link><guid isPermaLink="true">https://forum.qt.io/post/246894</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 09 Oct 2014 23:26:59 GMT</pubDate></item></channel></rss>