Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
5.9.0, 5.11, 5.14, 5.15.0, 6.2.2, 6.6.1
-
None
-
Windows 7, Windows 10 64bit, Qt 5.9.x+ both 32 and 64 bit
Description
It is only happening on Windows when doing actual printing (even to MS XPS document writer virtual printer).
Print output when painter is rotated by different angle works fine.
Creating PDF by setting QPrinter::PdfFormat created pdf comes out correctly
void PrintWidget::drawStuff(QPainter &p, const QRectF &dstRect) { p.save(); p.setRenderHints(QPainter::SmoothPixmapTransform, true); p.translate(dstRect.topLeft()); QRectF dst(0,0,dstRect.width(), dstRect.height()/2.0); if (!pm->isNull()) { QRectF src(0,0, pm->width(), pm->height()); p.drawPixmap(dst, *pm, src); // translate and rotate so picture appears 180deg rotated p.translate(dstRect.width(), dstRect.height()); p.rotate(180.0); // when printed on windows picture comes wrong /not rotated p.drawPixmap(dst, *pm, src); } else { p.drawText(dstRect, Qt::AlignCenter, "Picture not found!"); } p.restore(); }
I attached full example.
Left: Expected output, Right: what printout looks like: