diff options
Diffstat (limited to 'src/plugins/geometryloaders/default/objgeometryloader.cpp')
-rw-r--r-- | src/plugins/geometryloaders/default/objgeometryloader.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/plugins/geometryloaders/default/objgeometryloader.cpp b/src/plugins/geometryloaders/default/objgeometryloader.cpp index ad1bde7d4..b1fb1f931 100644 --- a/src/plugins/geometryloaders/default/objgeometryloader.cpp +++ b/src/plugins/geometryloaders/default/objgeometryloader.cpp @@ -40,12 +40,13 @@ #include "objgeometryloader.h" #include <QtCore/QLoggingCategory> +#include <QtCore/QRegularExpression> QT_BEGIN_NAMESPACE namespace Qt3DRender { -Q_LOGGING_CATEGORY(ObjGeometryLoaderLog, "Qt3D.ObjGeometryLoader") +Q_LOGGING_CATEGORY(ObjGeometryLoaderLog, "Qt3D.ObjGeometryLoader", QtWarningMsg) static void addFaceVertex(const FaceIndices &faceIndices, QVector<FaceIndices>& faceIndexVector, @@ -77,7 +78,7 @@ bool ObjGeometryLoader::doLoad(QIODevice *ioDev, const QString &subMesh) int normalsOffset = 0; int texCoordsOffset = 0; - QRegExp subMeshMatch(subMesh); + QRegularExpression subMeshMatch(subMesh); if (!subMeshMatch.isValid()) subMeshMatch.setPattern(QLatin1String("^(") + subMesh + QLatin1String(")$")); Q_ASSERT(subMeshMatch.isValid()); @@ -196,7 +197,8 @@ bool ObjGeometryLoader::doLoad(QIODevice *ioDev, const QString &subMesh) } else { if (!subMesh.isEmpty() ) { const QString objName = tokens.stringAt(1); - skipping = subMeshMatch.indexIn(objName) < 0; + QRegularExpressionMatch match = subMeshMatch.match(objName); + skipping = !match.hasMatch(); } } } @@ -217,7 +219,7 @@ bool ObjGeometryLoader::doLoad(QIODevice *ioDev, const QString &subMesh) if (hasNormals) m_normals.resize(vertexCount); - for (QHash<FaceIndices, unsigned int>::const_iterator it = faceIndexMap.begin(), endIt = faceIndexMap.end(); it != endIt; ++it) { + for (auto it = faceIndexMap.cbegin(), endIt = faceIndexMap.cend(); it != endIt; ++it) { m_points[it.value()] = positions[it.key().positionIndex]; if (hasTexCoords) m_texCoords[it.value()] = std::numeric_limits<unsigned int>::max() != it.key().texCoordIndex ? texCoords[it.key().texCoordIndex] : QVector2D(); @@ -229,7 +231,7 @@ bool ObjGeometryLoader::doLoad(QIODevice *ioDev, const QString &subMesh) const int indexCount = faceIndexVector.size(); m_indices.clear(); m_indices.reserve(indexCount); - for (const FaceIndices faceIndices : faceIndexVector) { + for (const FaceIndices faceIndices : qAsConst(faceIndexVector)) { const unsigned int i = faceIndexMap.value(faceIndices); m_indices.append(i); } |