From 3a7cda715a9d409c249f91e320a9e1f8e9276f37 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 1 Feb 2024 17:22:03 +0100 Subject: [PATCH] QPdfWriter: switch the default color model to Auto If a user specifies a color in CMYK, save it in CMYK by default (instead of converting it to RGB). [ChangeLog][QtGui][QPdfWriter] QPdfWriter by default will now save CMYK colors in CMYK, instead of converting them to RGB. You can use the setColorModel() function to restore the previous behavior. Change-Id: I2a699f99d44c106d59bf0e32c11f9cf9999d16e8 Reviewed-by: Lars Knoll --- src/gui/painting/qpdf.cpp | 2 +- src/gui/painting/qpdfwriter.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index f44a95ae7c5..73117d38fc0 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1436,7 +1436,7 @@ int QPdfEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const QPdfEnginePrivate::QPdfEnginePrivate() : clipEnabled(false), allClipped(false), hasPen(true), hasBrush(false), simplePen(false), needsTransform(false), pdfVersion(QPdfEngine::Version_1_4), - colorModel(QPdfEngine::ColorModel::RGB), + colorModel(QPdfEngine::ColorModel::Auto), outDevice(nullptr), ownsDevice(false), embedFonts(true), m_pageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(10, 10, 10, 10)) diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp index b3b6f3d310b..50db7465bd0 100644 --- a/src/gui/painting/qpdfwriter.cpp +++ b/src/gui/painting/qpdfwriter.cpp @@ -304,7 +304,7 @@ bool QPdfWriter::newPage() QPen and QBrush). \value RGB All colors are converted to RGB and saved as such in the - PDF. This is the default. + PDF. \value Grayscale All colors are converted to grayscale. For backwards compatibility, they are emitted in the PDF output as RGB colors, with @@ -314,6 +314,7 @@ bool QPdfWriter::newPage() \value Auto RGB colors are emitted as RGB; CMYK colors are emitted as CMYK. Colors of any other color spec are converted to RGB. + This is the default since Qt 6.8. \sa QColor, QGradient */