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 <lars@knoll.priv.no>
This commit is contained in:
Giuseppe D'Angelo 2024-02-01 17:22:03 +01:00
parent e35dcba5bb
commit 3a7cda715a
2 changed files with 3 additions and 2 deletions

View File

@ -1436,7 +1436,7 @@ int QPdfEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const
QPdfEnginePrivate::QPdfEnginePrivate() QPdfEnginePrivate::QPdfEnginePrivate()
: clipEnabled(false), allClipped(false), hasPen(true), hasBrush(false), simplePen(false), : clipEnabled(false), allClipped(false), hasPen(true), hasBrush(false), simplePen(false),
needsTransform(false), pdfVersion(QPdfEngine::Version_1_4), needsTransform(false), pdfVersion(QPdfEngine::Version_1_4),
colorModel(QPdfEngine::ColorModel::RGB), colorModel(QPdfEngine::ColorModel::Auto),
outDevice(nullptr), ownsDevice(false), outDevice(nullptr), ownsDevice(false),
embedFonts(true), embedFonts(true),
m_pageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(10, 10, 10, 10)) m_pageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(10, 10, 10, 10))

View File

@ -304,7 +304,7 @@ bool QPdfWriter::newPage()
QPen and QBrush). QPen and QBrush).
\value RGB All colors are converted to RGB and saved as such in the \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 \value Grayscale All colors are converted to grayscale. For backwards
compatibility, they are emitted in the PDF output as RGB colors, with 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 \value Auto RGB colors are emitted as RGB; CMYK colors are emitted as
CMYK. Colors of any other color spec are converted to RGB. CMYK. Colors of any other color spec are converted to RGB.
This is the default since Qt 6.8.
\sa QColor, QGradient \sa QColor, QGradient
*/ */