mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-05-28 00:30:23 -04:00
Port away from QPrinter::setPaperSize, deprecated in Qt 5.15
The formula was found in Qt's qt_pixelMultiplier (qpagesize.cpp) as called by the deprecated setPaperSize method (when the unit is DevicePixel) NO_CHANGELOG
This commit is contained in:
parent
bc3c04c7ce
commit
1ba23a1e8e
@ -251,7 +251,8 @@ bool EPSHandler::write(const QImage &image)
|
|||||||
psOut.setOutputFileName(tmpFile.fileName());
|
psOut.setOutputFileName(tmpFile.fileName());
|
||||||
psOut.setOutputFormat(QPrinter::PdfFormat);
|
psOut.setOutputFormat(QPrinter::PdfFormat);
|
||||||
psOut.setFullPage(true);
|
psOut.setFullPage(true);
|
||||||
psOut.setPaperSize(image.size(), QPrinter::DevicePixel);
|
const double multiplier = psOut.resolution() <= 0 ? 1.0 : 72.0 / psOut.resolution();
|
||||||
|
psOut.setPageSize(QPageSize(image.size() * multiplier, QPageSize::Point));
|
||||||
|
|
||||||
// painting the pixmap to the "printer" which is a file
|
// painting the pixmap to the "printer" which is a file
|
||||||
p.begin(&psOut);
|
p.begin(&psOut);
|
||||||
|
Loading…
Reference in New Issue
Block a user