From 789599f84e8ec74d9452bf49564aed78acc03945 Mon Sep 17 00:00:00 2001 From: Martin Reboredo Date: Mon, 29 Nov 2021 19:18:01 -0300 Subject: [PATCH] Renovate QString splits with newer enum in Gui --- Gui/DocumentationManager.cpp | 13 +++++++++++++ Gui/Gui40.cpp | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/Gui/DocumentationManager.cpp b/Gui/DocumentationManager.cpp index e28c8994d1..f6eb80ffec 100644 --- a/Gui/DocumentationManager.cpp +++ b/Gui/DocumentationManager.cpp @@ -229,12 +229,21 @@ DocumentationManager::handler(QHttpRequest *req, // get options QStringList options; if ( page.contains( QString::fromUtf8("?") ) ) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QStringList split = page.split(QString::fromUtf8("?"), Qt::SkipEmptyParts); + page = split.takeFirst(); + if (split.length() > 0) { + QString rawOptions = split.takeLast(); + options = rawOptions.split(QString::fromUtf8("&"), Qt::SkipEmptyParts); + } +#else QStringList split = page.split(QString::fromUtf8("?"), QString::SkipEmptyParts); page = split.takeFirst(); if (split.length() > 0) { QString rawOptions = split.takeLast(); options = rawOptions.split(QString::fromUtf8("&"), QString::SkipEmptyParts); } +#endif } // default page @@ -368,7 +377,11 @@ DocumentationManager::handler(QHttpRequest *req, ""); for (int i = 0; i < options.size(); ++i) { if ( options.at(i).contains( QString::fromUtf8("id=") ) ) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QStringList split = options.at(i).split(QString::fromUtf8("="), Qt::SkipEmptyParts); +#else QStringList split = options.at(i).split(QString::fromUtf8("="), QString::SkipEmptyParts); +#endif if (split.length() > 0) { QString groupID = split.takeLast(); group = groupID; diff --git a/Gui/Gui40.cpp b/Gui/Gui40.cpp index 6c26546e3a..e240798995 100644 --- a/Gui/Gui40.cpp +++ b/Gui/Gui40.cpp @@ -193,7 +193,11 @@ Gui::updateRecentFileActions() // split each dir, and find the common part of all dirs. std::vector dirParts(dirs.size()); for (int i = 0; i < dirs.size(); ++i) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + dirParts[i] = QDir::toNativeSeparators(dirs.at(i)).split(QDir::separator(), Qt::SkipEmptyParts); +#else dirParts[i] = QDir::toNativeSeparators(dirs.at(i)).split(QDir::separator(), QString::SkipEmptyParts); +#endif } int minComps = dirParts[0].size(); for (int i = 1; i < dirs.size(); ++i) { @@ -219,7 +223,11 @@ Gui::updateRecentFileActions() // remove the n first element to each dirName corresponding to this filename, and recompose for (int i = 0; i < numRecentFiles; ++i) { if (fileNames[i] == it->first) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + dirNames[i] = QStringList(QDir::toNativeSeparators(dirNames.at(i)).split(QDir::separator(), Qt::SkipEmptyParts).mid(commonComps)).join(QDir::separator()); +#else dirNames[i] = QStringList(QDir::toNativeSeparators(dirNames.at(i)).split(QDir::separator(), QString::SkipEmptyParts).mid(commonComps)).join(QDir::separator()); +#endif } } }