From 0eb789a1e22851e2f16a02a1b84a41648be7334e Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 29 Sep 2023 10:09:39 +0200 Subject: [PATCH 1/3] Material: fix build failure with Qt6 --- src/Mod/Material/App/MaterialLibrary.cpp | 2 ++ src/Mod/Material/App/MaterialValue.h | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/Mod/Material/App/MaterialLibrary.cpp b/src/Mod/Material/App/MaterialLibrary.cpp index 1233752be4..8e7803d2cb 100644 --- a/src/Mod/Material/App/MaterialLibrary.cpp +++ b/src/Mod/Material/App/MaterialLibrary.cpp @@ -81,7 +81,9 @@ Material* MaterialLibrary::saveMaterial(Material& material, const QString& path, if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream stream(&file); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) stream.setCodec("UTF-8"); +#endif stream.setGenerateByteOrderMark(true); // Write the contents diff --git a/src/Mod/Material/App/MaterialValue.h b/src/Mod/Material/App/MaterialValue.h index a39ff4578b..409c137d30 100644 --- a/src/Mod/Material/App/MaterialValue.h +++ b/src/Mod/Material/App/MaterialValue.h @@ -175,7 +175,20 @@ public: const QVariant getValue(int row, int column); protected: +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) std::map*>> _rowMap; +#else + struct variant_comp + { + bool operator()(const QVariant& var1, + const QVariant& var2) const + { + return QVariant::compare(var1, var2) == QPartialOrdering::Less; + } + }; + std::map*>, variant_comp> _rowMap; +#endif + bool _defaultSet; }; From f4c6504aa1963e9ee631a6b776e327a368ef1272 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 29 Sep 2023 11:05:07 +0200 Subject: [PATCH 2/3] Material: QMetaType::type(const char*) is deprecatred and shouldn't be used in new code --- src/Mod/Material/App/MaterialPyImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Material/App/MaterialPyImpl.cpp b/src/Mod/Material/App/MaterialPyImpl.cpp index 0120b66b00..8248f2951f 100644 --- a/src/Mod/Material/App/MaterialPyImpl.cpp +++ b/src/Mod/Material/App/MaterialPyImpl.cpp @@ -346,7 +346,7 @@ static PyObject* _pyObjectFromVariant(const QVariant& value) return new PyObject(); } - if (value.userType() == QMetaType::type("Base::Quantity")) { + if (value.userType() == qMetaTypeId()) { return new Base::QuantityPy(new Base::Quantity(value.value())); } else if (value.userType() == QMetaType::Double) { From fc5a4edef2316e020fd76b13f6839002bb9c1557 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 29 Sep 2023 11:19:25 +0200 Subject: [PATCH 3/3] Gui: fix build failure with Qt6 on macOS --- src/Gui/MetaTypes.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Gui/MetaTypes.h b/src/Gui/MetaTypes.h index 99b69ed431..bac3a6d42a 100644 --- a/src/Gui/MetaTypes.h +++ b/src/Gui/MetaTypes.h @@ -28,7 +28,10 @@ #include #include #include +#include +#include +// NOLINTBEGIN Q_DECLARE_METATYPE(Base::Vector3f) Q_DECLARE_METATYPE(Base::Vector3d) Q_DECLARE_METATYPE(QList) @@ -39,5 +42,6 @@ Q_DECLARE_METATYPE(Base::Quantity) Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(App::SubObjectT) Q_DECLARE_METATYPE(QList) +// NOLINTEND #endif // GUI_METATYPES_H