Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.11.3
-
None
Description
This is a bug with QPreviewPaintEngine.
If I use setClipPath to cut the original image, the preview data will disappear from the second page.
Comparing the generated preview QPictures , starting from page 2 , the data size starts to be different from that of page1 .
Here is my example:
QPrintPreviewDialog dialog; connect(&dialog, &QPrintPreviewDialog::paintRequested, this, [=](QPrinter *_printer){ QPainter p(_printer); QImage testImage(_printer->pageLayout().fullRectPixels(_printer->resolution()).size(), QImage::Format_ARGB32); testImage.fill(Qt::green); p.setClipRect(QRect(0, 0, 200, 200)); for (int i = 0; i < 10; ++i) { if (i != 0) _printer->newPage(); p.drawImage(0, 0, testImage); } for (int i = 0; i < _printer->d_func()->previewPages().count(); ++i) { qInfo() << "currentPage: " << i + 1 << "Pictures Data Size: " << _printer->d_func()->previewPages().at(i)->size(); } }); dialog.exec();
The following is the debug output of the program:
currentPage: 1 Pictures Data Size: 138 currentPage: 2 Pictures Data Size: 355 currentPage: 3 Pictures Data Size: 355 currentPage: 4 Pictures Data Size: 355 currentPage: 5 Pictures Data Size: 355 currentPage: 6 Pictures Data Size: 355 currentPage: 7 Pictures Data Size: 355 currentPage: 8 Pictures Data Size: 355 currentPage: 9 Pictures Data Size: 355 currentPage: 10 Pictures Data Size: 353
Obviously, the same image is used as the raw data, but the resulting data is not the same size.Even if the setClippath function is not used, the output data size is also not the same.