Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.8
-
None
-
-
1fb86f1f8 (dev), f349040b3 (6.9), 45f39ab5b (6.8), 611031e4f (dev), d6802feee (6.9)
Description
qDrawPlainRoundedRect was derived from qDrawPlainRect but due to the rounded borders it does not work well with high-dpi screens:
Code to reproduce the issue:
QPixmap drawPlainRoundedRect(qreal dpr, int lw) { QPixmap pm(100, 100); pm.setDevicePixelRatio(dpr); QColor col(Qt::green); col.setAlpha(128); QBrush brush(col); QRect rect = QRect(20 / dpr, 20 / dpr, 60 / dpr, 60 / dpr); pm.fill(Qt::black); QPainter p(&pm); //qDrawPlainRect(&p, rect, Qt::red, lw, &brush); qDrawPlainRoundedRect(&p, rect, 4, 4, Qt::red, lw, &brush); p.end(); return pm; } int main(int argc, char* argv[]) { QApplication app(argc, argv); QList<qreal> ratios = { 1.0, 1.11, 1.83, 2.75 }; QList<int> lineWidths = { 1, 2, 3, 4 }; QPixmap pixmap(400, 400); QPainter p(&pixmap); for (int i = 0; i < ratios.size(); ++i) { for (int j = 0; j < lineWidths.size(); ++j) { auto pm = drawPlainRoundedRect(ratios.at(i), lineWidths.at(j)); pm.setDevicePixelRatio(1); p.drawPixmap(i * 100, j * 100, pm); } } p.end(); pixmap.save("out.png"); return 0; }
qDrawPlainRect() also does some useless double-work so it should be cleaned up too.
Attachments
Issue Links
- relates to
-
QTBUG-131585 The QTreeWidget is painting poorly when the frame style is set to QFrame::Plain | QFrame::Box when using Windows 11 style.
-
- Closed
-