From a85db2c1d6e6a678e4ccf3ef5d4f53cfae980dfb Mon Sep 17 00:00:00 2001 From: Ladislav Michl Date: Sun, 14 Jan 2024 10:43:39 +0100 Subject: [PATCH] Material: fix Qt6 build failure QRegExp has been replaced with QRegularExpression and isn't part of the base of Qt6 any more --- src/Mod/Material/App/MaterialLoader.cpp | 14 +++++--------- src/Mod/Material/App/MaterialValue.cpp | 5 ++--- src/Mod/Material/App/ModelLibrary.cpp | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/Mod/Material/App/MaterialLoader.cpp b/src/Mod/Material/App/MaterialLoader.cpp index a6ab7a5a8a..fc0e6f14c7 100644 --- a/src/Mod/Material/App/MaterialLoader.cpp +++ b/src/Mod/Material/App/MaterialLoader.cpp @@ -21,16 +21,12 @@ #include "PreCompiled.h" #ifndef _PreComp_ -#include -#endif - #include #include #include #include - -#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) -#include +#include +#include #endif #include @@ -85,7 +81,7 @@ std::shared_ptr> MaterialYamlEntry::readList(const YAML::Node& n QVariant nodeValue; if (isImageList) { nodeValue = QString::fromStdString(it->as()) - .remove(QRegExp(QString::fromStdString("[\r\n]"))); + .remove(QRegularExpression(QString::fromStdString("[\r\n]"))); } else { nodeValue = QString::fromStdString(it->as()); @@ -247,7 +243,7 @@ void MaterialYamlEntry::addToTree( QString::fromStdString((itp->second).as()); if (type == MaterialValue::Image) { propertyValue = - propertyValue.remove(QRegExp(QString::fromStdString("[\r\n]"))); + propertyValue.remove(QRegularExpression(QString::fromStdString("[\r\n]"))); } finalModel->setPhysicalValue(QString::fromStdString(propertyName), propertyValue); @@ -314,7 +310,7 @@ void MaterialYamlEntry::addToTree( QString::fromStdString((itp->second).as()); if (type == MaterialValue::Image) { propertyValue = - propertyValue.remove(QRegExp(QString::fromStdString("[\r\n]"))); + propertyValue.remove(QRegularExpression(QString::fromStdString("[\r\n]"))); } finalModel->setAppearanceValue(QString::fromStdString(propertyName), propertyValue); diff --git a/src/Mod/Material/App/MaterialValue.cpp b/src/Mod/Material/App/MaterialValue.cpp index a9ccc6513e..f27bfed838 100644 --- a/src/Mod/Material/App/MaterialValue.cpp +++ b/src/Mod/Material/App/MaterialValue.cpp @@ -21,11 +21,10 @@ #include "PreCompiled.h" #ifndef _PreComp_ +#include #include #endif -#include - #include #include #include @@ -264,7 +263,7 @@ QString MaterialValue::getYAMLStringMultiLine() const QString yaml; yaml = QString::fromStdString(" |2"); auto list = - getValue().toString().split(QRegExp(QString::fromStdString("[\r\n]")), Qt::SkipEmptyParts); + getValue().toString().split(QRegularExpression(QString::fromStdString("[\r\n]")), Qt::SkipEmptyParts); for (auto& it : list) { yaml += QString::fromStdString("\n ") + it; } diff --git a/src/Mod/Material/App/ModelLibrary.cpp b/src/Mod/Material/App/ModelLibrary.cpp index baa244ecdd..63d06f2d06 100644 --- a/src/Mod/Material/App/ModelLibrary.cpp +++ b/src/Mod/Material/App/ModelLibrary.cpp @@ -55,7 +55,7 @@ QString LibraryBase::getLocalPath(const QString& path) const QString prefix = QString::fromStdString("/") + getName(); if (cleanPath.startsWith(prefix)) { // Remove the library name from the path - filePath += cleanPath.rightRef(cleanPath.length() - prefix.length()); + filePath += cleanPath.right(cleanPath.length() - prefix.length()); } else { filePath += cleanPath;