diff --git a/src/gui/painting/qpagedpaintdevice.h b/src/gui/painting/qpagedpaintdevice.h index 1c37c17fa3..21e23e0eb4 100644 --- a/src/gui/painting/qpagedpaintdevice.h +++ b/src/gui/painting/qpagedpaintdevice.h @@ -213,6 +213,7 @@ public: Envelope10 = Comm10E }; + // keep in sync with QPdfEngine::PdfVersion! enum PdfVersion { PdfVersion_1_4, PdfVersion_A1b, PdfVersion_1_6 }; // ### Qt6 Make these virtual diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h index e337c61f64..e5649eb9dc 100644 --- a/src/gui/painting/qpdf_p.h +++ b/src/gui/painting/qpdf_p.h @@ -168,6 +168,7 @@ class Q_GUI_EXPORT QPdfEngine : public QPaintEngine Q_DECLARE_PRIVATE(QPdfEngine) friend class QPdfWriter; public: + // keep in sync with QPagedPaintDevice::PdfVersion! enum PdfVersion { Version_1_4, diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp index 7f18ce42be..bf7e2d3dca 100644 --- a/src/gui/painting/qpdfwriter.cpp +++ b/src/gui/painting/qpdfwriter.cpp @@ -170,17 +170,11 @@ void QPdfWriter::setPdfVersion(PdfVersion version) { Q_D(QPdfWriter); - static const QHash engineMapping { - {QPdfWriter::PdfVersion_1_4, QPdfEngine::Version_1_4}, - {QPdfWriter::PdfVersion_A1b, QPdfEngine::Version_A1b}, - {QPdfWriter::PdfVersion_1_6, QPdfEngine::Version_1_6} - }; - if (d->pdfVersion == version) return; d->pdfVersion = version; - d->engine->setPdfVersion(engineMapping.value(version, QPdfEngine::Version_1_4)); + d->engine->setPdfVersion(static_cast(static_cast(version))); } /*!