Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.15.8, 6.2.4, 6.3.0 RC
Description
#include <QWidget> #include <QPainter> class MyWidget : public QWidget { Q_OBJECT public: MyWidget(QWidget *parent = nullptr) : QWidget(parent) {} protected: void paintEvent(QPaintEvent*) override { QPainter painter(this); painter.setPen(QPen(Qt::black, 1)); painter.drawPolyline( QPolygonF() << QPointF( 0, 0) << QPointF(10, 0) ); painter.drawPolyline( QPolygonF() << QPointF(10, 1) << QPointF(20, 1) ); painter.drawPolyline( QPolygonF() << QPointF( 0, 2) << QPointF(10, 2) ); painter.drawPolyline( QPolygonF() << QPointF(10, 3) << QPointF(20, 3) ); painter.setPen(QPen(Qt::green, 1)); painter.drawPolyline( QPolygonF() << QPointF(10, 2.99) << QPointF(20, 2.99) ); } };
The attached screenshots are zoomed in 50x
Expected behaviour
The green line is drawn at y==3, always.
Actual behaviour
The green line is drawn at y==2 for all versions of Qt at scaling==100%
The green line is drawn closer to y==3 for Qt 6 at scaling>=125%
The green line is drawn closer to y==3 for Qt 5 at scaling>=200% (with Qt::AA_EnableHighDpiScaling)