Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
4.6.2
-
None
-
windows 7
Description
When I draw line with a QPainter (using raster engine, with a cosmetic pen) to which I set a world transform matrix, it will sometimes display a wrong image. This will mostly happen when I draw a line whose start point is equal to its end point. But I have also watched this problem when I draw a vertical line, but this is a very rare case.
the following code can produce this problem:
QPainter painter(this);
QTransform t(
100000, -0, 0,
0, -100000, 0,
-44271.3, 46459.2, 1);
painter.setWorldTransform(t);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(Qt::magenta);
QPointF p(0.44375, 0.463636);
painter.drawLine(p, p);
you can attach the above code to your widget's paintEvent() method, and you will see your widget is filled with magenta color instead of displaying a line(actually should be a point).
I have debug this code and found that the cosmetic pen is not respected by drawLine(), It will draw a very big (because my world transform has very big scale factor) point instead of a one pixel width point.