From 1ba23a1e8e2506913ae08797534c2556d52c652c Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 4 Apr 2021 15:55:02 +0200 Subject: [PATCH] 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 --- src/imageformats/eps.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/imageformats/eps.cpp b/src/imageformats/eps.cpp index 53ecd99..6aebe2d 100644 --- a/src/imageformats/eps.cpp +++ b/src/imageformats/eps.cpp @@ -251,7 +251,8 @@ bool EPSHandler::write(const QImage &image) psOut.setOutputFileName(tmpFile.fileName()); psOut.setOutputFormat(QPrinter::PdfFormat); 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 p.begin(&psOut);