QPainter::drawRoundedRect not drawing regular rects?
Unsolved
General and Desktop
-
It appears as though
QPainter::drawRoundedRect
is not drawing regular rectangles? I am using Qt-5.14.2.Both of the following two examples use this code:
def paintEvent(self, e): p = QPainter(self) p.setPen(QPen(QColor('#5a9adb'), 1)) rect = QRect(50, 50, 50, 50) p.drawRoundedRect(rect, 5, 5)
The first example is on a display with
devicePixelRatio == 1
:
The first example is on a display with
devicePixelRatio == 2
:You can see in the first example how the upper right and lower left corners are somewhat similar but irregular, but the upper left and lower right corners are unique.
As a third example, here is how this plays out in some of my button types with
devicePixelRatio == 2
....using the following code:
rect = self.rect() rect.setWidth(rect.width() - 1) rect.setHeight(rect.height() - 1) if self.isDown() or self.isChecked() and not self.checkedPixmap: p = QPainter(self) p.setRenderHint(QPainter.Antialiasing, True) p.setBrush(util.CONTROL_BG) p.setPen(QPen(QColor('#5a9adb'), 1)) p.drawRoundedRect(rect, self.RADIUS, self.RADIUS) p.end() p = None
What can I do to make rounded rectangles more regular? I would say that behavior is unacceptable.
Thanks!