Merge pull request #10863 from wwmayer/material_fixes

Material: fix build failure with Qt6
This commit is contained in:
Chris Hennes
2023-09-29 22:50:18 -05:00
committed by GitHub
4 changed files with 20 additions and 1 deletions

View File

@@ -28,7 +28,10 @@
#include <Base/Placement.h>
#include <Base/Quantity.h>
#include <App/DocumentObserver.h>
#include <QMetaType>
#include <QList>
// NOLINTBEGIN
Q_DECLARE_METATYPE(Base::Vector3f)
Q_DECLARE_METATYPE(Base::Vector3d)
Q_DECLARE_METATYPE(QList<Base::Vector3d>)
@@ -39,5 +42,6 @@ Q_DECLARE_METATYPE(Base::Quantity)
Q_DECLARE_METATYPE(QList<Base::Quantity>)
Q_DECLARE_METATYPE(App::SubObjectT)
Q_DECLARE_METATYPE(QList<App::SubObjectT>)
// NOLINTEND
#endif // GUI_METATYPES_H

View File

@@ -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

View File

@@ -346,7 +346,7 @@ static PyObject* _pyObjectFromVariant(const QVariant& value)
return new PyObject();
}
if (value.userType() == QMetaType::type("Base::Quantity")) {
if (value.userType() == qMetaTypeId<Base::Quantity>()) {
return new Base::QuantityPy(new Base::Quantity(value.value<Base::Quantity>()));
}
else if (value.userType() == QMetaType::Double) {

View File

@@ -175,7 +175,20 @@ public:
const QVariant getValue(int row, int column);
protected:
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
std::map<QVariant, std::vector<std::vector<QVariant>*>> _rowMap;
#else
struct variant_comp
{
bool operator()(const QVariant& var1,
const QVariant& var2) const
{
return QVariant::compare(var1, var2) == QPartialOrdering::Less;
}
};
std::map<QVariant, std::vector<std::vector<QVariant>*>, variant_comp> _rowMap;
#endif
bool _defaultSet;
};