diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 31e8bbdc128..716cf35ee6d 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -23,6 +23,8 @@ #include #include +#include + #ifndef QT_NO_COMPRESS #include #endif @@ -1857,7 +1859,7 @@ void QPdfEnginePrivate::writeDestsRoot() if (destCache.isEmpty()) return; - QHash destObjects; + std::map destObjects; QByteArray xs, ys; for (const DestInfo &destInfo : std::as_const(destCache)) { int destObj = addXrefEntry(-1); @@ -1865,21 +1867,19 @@ void QPdfEnginePrivate::writeDestsRoot() ys.setNum(static_cast(destInfo.coords.y()), 'f'); xprintf("[%d 0 R /XYZ %s %s 0]\n", destInfo.pageObj, xs.constData(), ys.constData()); xprintf("endobj\n"); - destObjects.insert(destInfo.anchor, destObj); + destObjects.insert_or_assign(destInfo.anchor, destObj); } // names destsRoot = addXrefEntry(-1); - QStringList anchors = destObjects.keys(); - anchors.sort(); xprintf("<<\n/Limits ["); - printString(anchors.constFirst()); + printString(destObjects.begin()->first); xprintf(" "); - printString(anchors.constLast()); + printString(destObjects.rbegin()->first); xprintf("]\n/Names [\n"); - for (const QString &anchor : std::as_const(anchors)) { + for (const auto &[anchor, destObject] : destObjects) { printString(anchor); - xprintf(" %d 0 R\n", destObjects[anchor]); + xprintf(" %d 0 R\n", destObject); } xprintf("]\n>>\n" "endobj\n");