diff options
author | Mike Krus <mike.krus@kdab.com> | 2020-11-14 14:42:32 +0000 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-11-23 18:51:18 +0000 |
commit | 9fdb28d4a553561eabf11210d0b2146e78200844 (patch) | |
tree | edf2521e005f215d97cae8701fb9dd77f09d6412 | |
parent | 9e2770d8995aedb07c517dd31395c8bb3a605def (diff) |
Fix deprecated API usage and compile warnings
- QVariant::Type deprecated, use QMetaType related APIs
- QNodeId not used as reference in for loops (nop but really noisy)
- some unused code
Change-Id: I08f72181ae6eeb369ca41015a21813cd7bf05231
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
(cherry picked from commit 490fa176b69a390ce13168ae6c87623449b36d88)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
53 files changed, 286 insertions, 307 deletions
diff --git a/examples/qt3d/3d-text/main.cpp b/examples/qt3d/3d-text/main.cpp index 43ef47ce2..01243509b 100644 --- a/examples/qt3d/3d-text/main.cpp +++ b/examples/qt3d/3d-text/main.cpp @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) auto *textMaterial = new Qt3DExtras::QPhongMaterial(root); { // text int i = 0; - const QStringList fonts = QFontDatabase().families(); + const QStringList fonts = QFontDatabase::families(); for (const QString &family : fonts) { diff --git a/src/animation/backend/animationclip.cpp b/src/animation/backend/animationclip.cpp index 9f18b5eed..699d4dc50 100644 --- a/src/animation/backend/animationclip.cpp +++ b/src/animation/backend/animationclip.cpp @@ -167,12 +167,12 @@ void AnimationClip::loadAnimation() // that the clip has changed and that they are now dirty { QMutexLocker lock(&m_mutex); - for (const Qt3DCore::QNodeId id : qAsConst(m_dependingAnimators)) { + for (const Qt3DCore::QNodeId &id : qAsConst(m_dependingAnimators)) { ClipAnimator *animator = m_handler->clipAnimatorManager()->lookupResource(id); if (animator) animator->animationClipMarkedDirty(); } - for (const Qt3DCore::QNodeId id : qAsConst(m_dependingBlendedAnimators)) { + for (const Qt3DCore::QNodeId &id : qAsConst(m_dependingBlendedAnimators)) { BlendedClipAnimator *animator = m_handler->blendedClipAnimatorManager()->lookupResource(id); if (animator) animator->animationClipMarkedDirty(); diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp index b44b467de..e2cb04c15 100644 --- a/src/animation/backend/animationutils.cpp +++ b/src/animation/backend/animationutils.cpp @@ -163,10 +163,10 @@ ComponentIndices channelComponentsToIndices(const Channel &channel, static const QList<char> colorSuffixesRGBA = { 'R', 'G', 'B', 'A' }; switch (dataType) { - case QVariant::Quaternion: + case QMetaType::QQuaternion: return channelComponentsToIndicesHelper(channel, expectedComponentCount, offset, quaternionSuffixes); - case QVariant::Color: + case QMetaType::QColor: if (expectedComponentCount == 3) return channelComponentsToIndicesHelper(channel, expectedComponentCount, offset, colorSuffixesRGB); @@ -184,7 +184,7 @@ ComponentIndices channelComponentsToIndicesHelper(const Channel &channel, int offset, const QList<char> &suffixes) { - const int actualComponentCount = channel.channelComponents.size(); + const int actualComponentCount = int(channel.channelComponents.size()); if (actualComponentCount != expectedComponentCount) { qWarning() << "Data type expects" << expectedComponentCount << "but found" << actualComponentCount << "components in the animation clip"; @@ -351,24 +351,24 @@ QVariant buildPropertyValue(const MappingData &mappingData, const QList<float> & switch (mappingData.type) { case QMetaType::Float: - case QVariant::Double: { + case QMetaType::Double: { return QVariant::fromValue(channelResults[mappingData.channelIndices[0]]); } - case QVariant::Vector2D: { + case QMetaType::QVector2D: { const QVector2D vector(channelResults[mappingData.channelIndices[0]], channelResults[mappingData.channelIndices[1]]); return QVariant::fromValue(vector); } - case QVariant::Vector3D: { + case QMetaType::QVector3D: { const QVector3D vector(channelResults[mappingData.channelIndices[0]], channelResults[mappingData.channelIndices[1]], channelResults[mappingData.channelIndices[2]]); return QVariant::fromValue(vector); } - case QVariant::Vector4D: { + case QMetaType::QVector4D: { const QVector4D vector(channelResults[mappingData.channelIndices[0]], channelResults[mappingData.channelIndices[1]], channelResults[mappingData.channelIndices[2]], @@ -376,7 +376,7 @@ QVariant buildPropertyValue(const MappingData &mappingData, const QList<float> & return QVariant::fromValue(vector); } - case QVariant::Quaternion: { + case QMetaType::QQuaternion: { QQuaternion q(channelResults[mappingData.channelIndices[0]], channelResults[mappingData.channelIndices[1]], channelResults[mappingData.channelIndices[2]], @@ -385,7 +385,7 @@ QVariant buildPropertyValue(const MappingData &mappingData, const QList<float> & return QVariant::fromValue(q); } - case QVariant::Color: { + case QMetaType::QColor: { // A color can either be a vec3 or a vec4 const QColor color = QColor::fromRgbF(channelResults[mappingData.channelIndices[0]], @@ -395,11 +395,12 @@ QVariant buildPropertyValue(const MappingData &mappingData, const QList<float> & return QVariant::fromValue(color); } - case QVariant::List: { + case QMetaType::QVariantList: { const QVariantList results = mapChannelResultsToContainer<QVariantList>( mappingData, channelResults); return QVariant::fromValue(results); } + default: qWarning() << "Unhandled animation type" << mappingData.type; break; @@ -528,7 +529,7 @@ QList<MappingData> buildPropertyMappings(const QList<ChannelMapping*> &channelMa mappingData.callback = mapping->callback(); mappingData.callbackFlags = mapping->callbackFlags(); - if (mappingData.type == static_cast<int>(QVariant::Invalid)) { + if (mappingData.type == static_cast<int>(QMetaType::UnknownType)) { qWarning() << "Unknown type for node id =" << mappingData.targetId << "and property =" << mapping->propertyName() << "and callback =" << mapping->callback(); @@ -558,9 +559,9 @@ QList<MappingData> buildPropertyMappings(const QList<ChannelMapping*> &channelMa case ChannelMapping::SkeletonMappingType: { const QList<ChannelNameAndType> jointProperties - = { { QLatin1String("Location"), static_cast<int>(QVariant::Vector3D), Translation }, - { QLatin1String("Rotation"), static_cast<int>(QVariant::Quaternion), Rotation }, - { QLatin1String("Scale"), static_cast<int>(QVariant::Vector3D), Scale } }; + = { { QLatin1String("Location"), static_cast<int>(QMetaType::QVector3D), Translation }, + { QLatin1String("Rotation"), static_cast<int>(QMetaType::QQuaternion), Rotation }, + { QLatin1String("Scale"), static_cast<int>(QMetaType::QVector3D), Scale } }; const QHash<QString, const char *> channelNameToPropertyName = { { QLatin1String("Location"), "translation" }, { QLatin1String("Rotation"), "rotation" }, @@ -636,7 +637,7 @@ QList<ChannelNameAndType> buildRequiredChannelsAndTypes(Handler *handler, // We could add them all then sort and remove duplicates. However, our approach has the // advantage of keeping the blend tree format more consistent with the mapping // orderings which will have better cache locality when generating events. - for (const Qt3DCore::QNodeId mappingId : mappingIds) { + for (const Qt3DCore::QNodeId &mappingId : mappingIds) { // Get the mapping object ChannelMapping *mapping = mappingManager->lookupResource(mappingId); Q_ASSERT(mapping); @@ -661,9 +662,9 @@ QList<ChannelNameAndType> buildRequiredChannelsAndTypes(Handler *handler, // Add an entry for each scale/rotation/translation property of each joint index // of the target skeleton. const QList<ChannelNameAndType> jointProperties - = { { QLatin1String("Location"), static_cast<int>(QVariant::Vector3D), Translation }, - { QLatin1String("Rotation"), static_cast<int>(QVariant::Quaternion), Rotation }, - { QLatin1String("Scale"), static_cast<int>(QVariant::Vector3D), Scale } }; + = { { QLatin1String("Location"), static_cast<int>(QMetaType::QVector3D), Translation }, + { QLatin1String("Rotation"), static_cast<int>(QMetaType::QQuaternion), Rotation }, + { QLatin1String("Scale"), static_cast<int>(QMetaType::QVector3D), Scale } }; Skeleton *skeleton = handler->skeletonManager()->lookupResource(mapping->skeletonId()); const int jointCount = skeleton->jointCount(); for (int jointIndex = 0; jointIndex < jointCount; ++jointIndex) { @@ -732,7 +733,7 @@ QList<Qt3DCore::QNodeId> gatherValueNodesToEvaluate(Handler *handler, clipIds.append(blendNode->peerId()); const auto dependencyIds = blendNode->currentDependencyIds(); - for (const auto dependencyId : dependencyIds) { + for (const auto &dependencyId : dependencyIds) { // Look up the blend node and if it's a value type (clip), // add it to the set of value node ids that need to be evaluated ClipBlendNode *node = nodeManager->lookupNode(dependencyId); diff --git a/src/animation/backend/buildblendtreesjob.cpp b/src/animation/backend/buildblendtreesjob.cpp index aeaaa8c11..a9a6ce36c 100644 --- a/src/animation/backend/buildblendtreesjob.cpp +++ b/src/animation/backend/buildblendtreesjob.cpp @@ -107,7 +107,7 @@ void BuildBlendTreesJob::run() // a QList<QClipBlendValue*> as input. QList<ClipBlendValue *> valueNodes; valueNodes.reserve(valueNodeIds.size()); - for (const auto valueNodeId : valueNodeIds) { + for (const auto &valueNodeId : valueNodeIds) { ClipBlendValue *valueNode = static_cast<ClipBlendValue *>(m_handler->clipBlendNodeManager()->lookupNode(valueNodeId)); Q_ASSERT(valueNode); @@ -184,7 +184,7 @@ void BuildBlendTreesJob::run() const QList<Qt3DCore::QNodeId> channelMappingIds = mapper->mappingIds(); QList<ChannelMapping *> channelMappings; channelMappings.reserve(channelMappingIds.size()); - for (const auto mappingId : channelMappingIds) { + for (const auto &mappingId : channelMappingIds) { ChannelMapping *mapping = m_handler->channelMappingManager()->lookupResource(mappingId); Q_ASSERT(mapping); channelMappings.push_back(mapping); diff --git a/src/animation/backend/channelmapping.cpp b/src/animation/backend/channelmapping.cpp index cfc6a16ef..c76f2e239 100644 --- a/src/animation/backend/channelmapping.cpp +++ b/src/animation/backend/channelmapping.cpp @@ -54,7 +54,7 @@ ChannelMapping::ChannelMapping() : BackendNode(ReadOnly) , m_channelName() , m_targetId() - , m_type(static_cast<int>(QVariant::Invalid)) + , m_type(static_cast<int>(QMetaType::UnknownType)) , m_componentCount(0) , m_propertyName(nullptr) , m_callback(nullptr) @@ -68,7 +68,7 @@ void ChannelMapping::cleanup() setEnabled(false); m_channelName.clear(); m_targetId = Qt3DCore::QNodeId(); - m_type = static_cast<int>(QVariant::Invalid); + m_type = static_cast<int>(QMetaType::UnknownType); m_propertyName = nullptr; m_componentCount = 0; m_callback = nullptr; diff --git a/src/animation/backend/clipblendnode.cpp b/src/animation/backend/clipblendnode.cpp index 37887664b..a44575064 100644 --- a/src/animation/backend/clipblendnode.cpp +++ b/src/animation/backend/clipblendnode.cpp @@ -134,7 +134,7 @@ void ClipBlendNode::blend(Qt3DCore::QNodeId animatorId) const int dependencyCount = dependencyNodeIds.size(); QList<ClipResults> blendData; blendData.reserve(dependencyCount); - for (const auto dependencyId : dependencyNodeIds) { + for (const auto &dependencyId : dependencyNodeIds) { ClipBlendNode *dependencyNode = clipBlendNodeManager()->lookupNode(dependencyId); ClipResults blendDataElement = dependencyNode->clipResults(animatorId); blendData.push_back(blendDataElement); diff --git a/src/animation/backend/clipblendnodevisitor.cpp b/src/animation/backend/clipblendnodevisitor.cpp index 5e63a4e79..0759dfa06 100644 --- a/src/animation/backend/clipblendnodevisitor.cpp +++ b/src/animation/backend/clipblendnodevisitor.cpp @@ -106,7 +106,7 @@ void ClipBlendNodeVisitor::visitPreOrderAllNodes(ClipBlendNode *node, { visitFunction(node); const Qt3DCore::QNodeIdVector childIds = node->allDependencyIds(); - for (const Qt3DCore::QNodeId childId: childIds) { + for (const Qt3DCore::QNodeId &childId: childIds) { ClipBlendNode *childNode = m_manager->lookupNode(childId); if (childNode != nullptr) visitPreOrderAllNodes(childNode, visitFunction); @@ -122,7 +122,7 @@ void ClipBlendNodeVisitor::visitPostOrderAllNodes(ClipBlendNode *node, const VisitFunction &visitFunction) const { const Qt3DCore::QNodeIdVector childIds = node->allDependencyIds(); - for (const Qt3DCore::QNodeId childId: childIds) { + for (const Qt3DCore::QNodeId &childId: childIds) { ClipBlendNode *childNode = m_manager->lookupNode(childId); if (childNode != nullptr) visitPostOrderAllNodes(childNode, visitFunction); @@ -140,7 +140,7 @@ void ClipBlendNodeVisitor::visitPreOrderDependencyNodes(ClipBlendNode *node, { visitFunction(node); const Qt3DCore::QNodeIdVector childIds = node->currentDependencyIds(); - for (const Qt3DCore::QNodeId childId: childIds) { + for (const Qt3DCore::QNodeId &childId: childIds) { ClipBlendNode *childNode = m_manager->lookupNode(childId); if (childNode != nullptr) visitPreOrderDependencyNodes(childNode, visitFunction); @@ -156,7 +156,7 @@ void ClipBlendNodeVisitor::visitPostOrderDependencyNodes(ClipBlendNode *node, const VisitFunction &visitFunction) const { const Qt3DCore::QNodeIdVector childIds = node->currentDependencyIds(); - for (const Qt3DCore::QNodeId childId: childIds) { + for (const Qt3DCore::QNodeId &childId: childIds) { ClipBlendNode *childNode = m_manager->lookupNode(childId); if (childNode != nullptr) visitPostOrderDependencyNodes(childNode, visitFunction); diff --git a/src/animation/backend/evaluateblendclipanimatorjob.cpp b/src/animation/backend/evaluateblendclipanimatorjob.cpp index dad5be6ab..cfb2be1e0 100644 --- a/src/animation/backend/evaluateblendclipanimatorjob.cpp +++ b/src/animation/backend/evaluateblendclipanimatorjob.cpp @@ -103,7 +103,7 @@ void EvaluateBlendClipAnimatorJob::run() // contained animation clips at the current phase and store the results // in the animator indexed by node. AnimationClipLoaderManager *clipLoaderManager = m_handler->animationClipLoaderManager(); - for (const auto valueNodeId : valueNodeIdsToEvaluate) { + for (const auto &valueNodeId : valueNodeIdsToEvaluate) { ClipBlendValue *valueNode = static_cast<ClipBlendValue *>(blendNodeManager->lookupNode(valueNodeId)); Q_ASSERT(valueNode); AnimationClip *clip = clipLoaderManager->lookupResource(valueNode->clipId()); diff --git a/src/animation/backend/gltfimporter.cpp b/src/animation/backend/gltfimporter.cpp index 06ff6be67..910fd86fa 100644 --- a/src/animation/backend/gltfimporter.cpp +++ b/src/animation/backend/gltfimporter.cpp @@ -97,7 +97,7 @@ void jsonArrayToSqt(const QJsonArray &jsonArray, Qt3DCore::Sqt &sqt) QMatrix4x4 m; float *data = m.data(); int i = 0; - for (const auto &element : jsonArray) + for (const auto element : jsonArray) *(data + i++) = static_cast<float>(element.toDouble()); decomposeQMatrix4x4(m, sqt); @@ -689,27 +689,27 @@ bool GLTFImporter::parseGLTF2() { bool success = true; const QJsonArray buffers = m_json.object().value(KEY_BUFFERS).toArray(); - for (const auto &bufferValue : buffers) + for (const auto bufferValue : buffers) success &= processJSONBuffer(bufferValue.toObject()); const QJsonArray bufferViews = m_json.object().value(KEY_BUFFER_VIEWS).toArray(); - for (const auto &bufferViewValue : bufferViews) + for (const auto bufferViewValue : bufferViews) success &= processJSONBufferView(bufferViewValue.toObject()); const QJsonArray accessors = m_json.object().value(KEY_ACCESSORS).toArray(); - for (const auto &accessorValue : accessors) + for (const auto accessorValue : accessors) success &= processJSONAccessor(accessorValue.toObject()); const QJsonArray skins = m_json.object().value(KEY_SKINS).toArray(); - for (const auto &skinValue : skins) + for (const auto skinValue : skins) success &= processJSONSkin(skinValue.toObject()); const QJsonArray animations = m_json.object().value(KEY_ANIMATIONS).toArray(); - for (const auto &animationValue : animations) + for (const auto animationValue : animations) success &= processJSONAnimation(animationValue.toObject()); const QJsonArray nodes = m_json.object().value(KEY_NODES).toArray(); - for (const auto &nodeValue : nodes) + for (const auto nodeValue : nodes) success &= processJSONNode(nodeValue.toObject()); setupNodeParentLinks(); diff --git a/src/animation/frontend/qcallbackmapping.cpp b/src/animation/frontend/qcallbackmapping.cpp index dcc352b17..435155e6b 100644 --- a/src/animation/frontend/qcallbackmapping.cpp +++ b/src/animation/frontend/qcallbackmapping.cpp @@ -47,7 +47,7 @@ namespace Qt3DAnimation { QCallbackMappingPrivate::QCallbackMappingPrivate() : QAbstractChannelMappingPrivate() , m_channelName() - , m_type(static_cast<int>(QVariant::Invalid)) + , m_type(static_cast<int>(QMetaType::UnknownType)) , m_callback(nullptr) { m_mappingType = QAbstractChannelMappingPrivate::CallbackMapping; @@ -107,8 +107,8 @@ void QCallbackMapping::setChannelName(const QString &channelName) on the gui/main thread, or directly on one of the thread pool's worker thread. This is controlled by \a flags. - \a type specifies the type (for example, QVariant::Vector3D, - QVariant::Color, or QMetaType::Float) of the animated value. When animating + \a type specifies the type (for example, QMetaType::QVector3D, + QMetaType::QColor, or QMetaType::Float) of the animated value. When animating node properties this does not need to be provided separately, however it becomes important to supply this when there is only a callback. diff --git a/src/animation/frontend/qchannelmapping.cpp b/src/animation/frontend/qchannelmapping.cpp index 9c6687031..f707dadb3 100644 --- a/src/animation/frontend/qchannelmapping.cpp +++ b/src/animation/frontend/qchannelmapping.cpp @@ -74,21 +74,21 @@ int componentCountForType(int type, const QVariant &value) switch (type) { case QMetaType::Float: - case QVariant::Double: + case QMetaType::Double: return 1; - case QVariant::Vector2D: + case QMetaType::QVector2D: return 2; - case QVariant::Vector3D: - case QVariant::Color: + case QMetaType::QVector3D: + case QMetaType::QColor: return 3; - case QVariant::Vector4D: - case QVariant::Quaternion: + case QMetaType::QVector4D: + case QMetaType::QQuaternion: return 4; - case QVariant::List: + case QMetaType::QVariantList: return componentCountForValue<QVariantList>(value.toList()); default: @@ -105,7 +105,7 @@ QChannelMappingPrivate::QChannelMappingPrivate() , m_target(nullptr) , m_property() , m_propertyName(nullptr) - , m_type(static_cast<int>(QVariant::Invalid)) + , m_type(static_cast<int>(QMetaType::UnknownType)) , m_componentCount(0) { m_mappingType = ChannelMapping; @@ -123,7 +123,7 @@ void QChannelMappingPrivate::updatePropertyNameTypeAndComponentCount() const char *propertyName = nullptr; if (!m_target || m_property.isNull()) { - type = QVariant::Invalid; + type = QMetaType::UnknownType; } else { const QMetaObject *mo = m_target->metaObject(); const int propertyIndex = mo->indexOfProperty(m_property.toLocal8Bit()); diff --git a/src/input/backend/loadproxydevicejob.cpp b/src/input/backend/loadproxydevicejob.cpp index 5219a5546..3f9d3c211 100644 --- a/src/input/backend/loadproxydevicejob.cpp +++ b/src/input/backend/loadproxydevicejob.cpp @@ -98,7 +98,7 @@ void LoadProxyDeviceJob::run() d->updates.reserve(m_proxies.size()); Q_ASSERT(m_inputHandler); - for (const Qt3DCore::QNodeId id : qAsConst(m_proxies)) { + for (const Qt3DCore::QNodeId &id : qAsConst(m_proxies)) { PhysicalDeviceProxy *proxy = m_inputHandler->physicalDeviceProxyManager()->lookupResource(id); QAbstractPhysicalDevice *device = m_inputHandler->createPhysicalDevice(proxy->deviceName()); if (device != nullptr) diff --git a/src/input/backend/updateaxisactionjob.cpp b/src/input/backend/updateaxisactionjob.cpp index b230f6865..305d5031b 100644 --- a/src/input/backend/updateaxisactionjob.cpp +++ b/src/input/backend/updateaxisactionjob.cpp @@ -93,12 +93,12 @@ void UpdateAxisActionJob::updateAction(LogicalDevice *device) const auto actionIds = device->actions(); d->m_triggeredActions.reserve(actionIds.size()); - for (const Qt3DCore::QNodeId actionId : actionIds) { + for (const Qt3DCore::QNodeId &actionId : actionIds) { bool actionTriggered = false; Action *action = m_handler->actionManager()->lookupResource(actionId); const auto actionInputIds = action->inputs(); - for (const Qt3DCore::QNodeId actionInputId : actionInputIds) + for (const Qt3DCore::QNodeId &actionInputId : actionInputIds) actionTriggered |= processActionInput(actionInputId); if (action->isEnabled() && (action->actionTriggered() != actionTriggered)) { @@ -121,12 +121,12 @@ void UpdateAxisActionJob::updateAxis(LogicalDevice *device) const auto axisIds = device->axes(); d->m_triggeredAxis.reserve(axisIds.size()); - for (const Qt3DCore::QNodeId axisId : axisIds) { + for (const Qt3DCore::QNodeId &axisId : axisIds) { Axis *axis = m_handler->axisManager()->lookupResource(axisId); float axisValue = 0.0f; const auto axisInputIds = axis->inputs(); - for (const Qt3DCore::QNodeId axisInputId : axisInputIds) + for (const Qt3DCore::QNodeId &axisInputId : axisInputIds) axisValue += processAxisInput(axisInputId); // Clamp the axisValue -1/1 diff --git a/src/plugins/geometryloaders/default/objgeometryloader.cpp b/src/plugins/geometryloaders/default/objgeometryloader.cpp index 0d4c22ec3..2bc35f06a 100644 --- a/src/plugins/geometryloaders/default/objgeometryloader.cpp +++ b/src/plugins/geometryloaders/default/objgeometryloader.cpp @@ -238,7 +238,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 : qAsConst(faceIndexVector)) { + for (const FaceIndices &faceIndices : qAsConst(faceIndexVector)) { const unsigned int i = faceIndexMap.value(faceIndices); m_indices.append(i); } diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp index c9763fb0e..56af99d6a 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp @@ -321,7 +321,7 @@ void GraphicsContext::loadShader(Shader *shaderNode, } } else { // Find an already loaded shader that shares the same QOpenGLShaderProgram - for (const Qt3DCore::QNodeId sharedShaderId : sharedShaderIds) { + for (const Qt3DCore::QNodeId &sharedShaderId : sharedShaderIds) { if (sharedShaderId != shaderNode->peerId()) { Shader *refShader = shaderManager->lookupResource(sharedShaderId); // We only introspect once per actual OpenGL shader program diff --git a/src/plugins/renderers/opengl/graphicshelpers/qgraphicsutils_p.h b/src/plugins/renderers/opengl/graphicshelpers/qgraphicsutils_p.h index a2a995811..f059012da 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/qgraphicsutils_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/qgraphicsutils_p.h @@ -96,7 +96,7 @@ public: static QVarLengthArray<char, 64> array(16 * byteSize); memset(array.data(), 0, array.size()); - switch (static_cast<QMetaType::Type>(v.type())) { + switch (v.metaType().id()) { // 1 byte case QMetaType::Bool: { @@ -332,7 +332,7 @@ public: } } else - qWarning() << Q_FUNC_INFO << "QVariant type conversion not handled for " << v.type(); + qWarning() << Q_FUNC_INFO << "QVariant type conversion not handled for " << v.metaType().id(); break; } diff --git a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp index 72368ae1e..2df7b7736 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp @@ -1292,7 +1292,7 @@ bool SubmissionContext::setParameters(ShaderParameterPack ¶meterPack, GLShad // Bind Shader Storage block to SSBO and update SSBO const std::vector<BlockToSSBO> &blockToSSBOs = parameterPack.shaderStorageBuffers(); - for (const BlockToSSBO b : blockToSSBOs) { + for (const BlockToSSBO &b : blockToSSBOs) { Buffer *cpuBuffer = m_renderer->nodeManagers()->bufferManager()->lookupResource(b.m_bufferID); GLBuffer *ssbo = glBufferForRenderBuffer(cpuBuffer); // bindShaderStorageBlock diff --git a/src/plugins/renderers/opengl/renderer/renderer.cpp b/src/plugins/renderers/opengl/renderer/renderer.cpp index 2ba38caeb..26b2b0ed8 100644 --- a/src/plugins/renderers/opengl/renderer/renderer.cpp +++ b/src/plugins/renderers/opengl/renderer/renderer.cpp @@ -1002,7 +1002,7 @@ void Renderer::lookForDirtyTextures() const QNodeIdVector imageIds = texture->textureImageIds(); // Does the texture reference any of the dirty texture images? - for (const QNodeId imageId: imageIds) { + for (const QNodeId &imageId: imageIds) { if (dirtyImageIds.contains(imageId)) { texture->addDirtyFlag(Texture::DirtyImageGenerators); break; @@ -1354,7 +1354,7 @@ void Renderer::updateTexture(Texture *texture) std::vector<GLTexture::Image> images; images.reserve(textureImageIds.size()); // TODO: Move this into GLTexture directly - for (const QNodeId textureImageId : textureImageIds) { + for (const QNodeId &textureImageId : textureImageIds) { const TextureImage *img = m_nodesManager->textureImageManager()->lookupResource(textureImageId); if (img == nullptr) { qWarning() << Q_FUNC_INFO << "invalid TextureImage handle"; @@ -1502,7 +1502,7 @@ Renderer::ViewSubmissionResultData Renderer::submitRenderViews(const std::vector // Insert Fence into command stream if needed const Qt3DCore::QNodeIdVector insertFenceIds = renderView->insertFenceIds(); GLFenceManager *fenceManager = m_glResourceManagers->glFenceManager(); - for (const Qt3DCore::QNodeId insertFenceId : insertFenceIds) { + for (const Qt3DCore::QNodeId &insertFenceId : insertFenceIds) { // If the fence is not in the manager, then it hasn't been inserted // into the command stream yet. if (fenceManager->find(insertFenceId) == fenceManager->end()) { @@ -2218,7 +2218,7 @@ void Renderer::cleanGraphicsResources() // When Textures are cleaned up, their id is saved so that they can be // cleaned up in the render thread const QList<Qt3DCore::QNodeId> cleanedUpTextureIds = std::move(m_textureIdsToCleanup); - for (const Qt3DCore::QNodeId textureCleanedUpId: cleanedUpTextureIds) + for (const Qt3DCore::QNodeId &textureCleanedUpId: cleanedUpTextureIds) cleanupTexture(textureCleanedUpId); // Delete abandoned VAOs @@ -2240,7 +2240,7 @@ void Renderer::cleanGraphicsResources() // that when this gets executed, all scene changes have been received and // shader nodes updated const QList<Qt3DCore::QNodeId> cleanedUpShaderIds = m_nodesManager->shaderManager()->takeShaderIdsToCleanup(); - for (const Qt3DCore::QNodeId shaderCleanedUpId: cleanedUpShaderIds) { + for (const Qt3DCore::QNodeId &shaderCleanedUpId: cleanedUpShaderIds) { cleanupShader(m_nodesManager->shaderManager()->lookupResource(shaderCleanedUpId)); // We can really release the texture at this point m_nodesManager->shaderManager()->releaseResource(shaderCleanedUpId); diff --git a/src/plugins/renderers/rhi/renderer/pipelineuboset.cpp b/src/plugins/renderers/rhi/renderer/pipelineuboset.cpp index 786a7e3ee..0031d927d 100644 --- a/src/plugins/renderers/rhi/renderer/pipelineuboset.cpp +++ b/src/plugins/renderers/rhi/renderer/pipelineuboset.cpp @@ -391,6 +391,7 @@ void PipelineUBOSet::uploadUBOs(SubmissionContext *ctx, RenderView *rv) } namespace { +/* void printUpload(const UniformValue &value, const QShaderDescription::BlockVariable &member, int arrayOffset) { switch (member.type) { @@ -423,6 +424,7 @@ void printUpload(const UniformValue &value, const QShaderDescription::BlockVaria break; } } +//*/ inline void uploadDataToUBO(const QByteArray rawData, const PipelineUBOSet::MultiUBOBufferWithBindingAndBlockSize *ubo, diff --git a/src/plugins/renderers/rhi/renderer/renderer.cpp b/src/plugins/renderers/rhi/renderer/renderer.cpp index aa18f093e..46a0107e1 100644 --- a/src/plugins/renderers/rhi/renderer/renderer.cpp +++ b/src/plugins/renderers/rhi/renderer/renderer.cpp @@ -1969,7 +1969,7 @@ void Renderer::updateTexture(Texture *texture) std::vector<RHITexture::Image> images; images.reserve(textureImageIds.size()); // TODO: Move this into RHITexture directly - for (const QNodeId textureImageId : textureImageIds) { + for (const QNodeId &textureImageId : textureImageIds) { const TextureImage *img = m_nodesManager->textureImageManager()->lookupResource(textureImageId); if (img == nullptr) { @@ -2963,7 +2963,7 @@ void Renderer::cleanGraphicsResources() // When Textures are cleaned up, their id is saved so that they can be // cleaned up in the render thread const QList<Qt3DCore::QNodeId> cleanedUpTextureIds = std::move(m_textureIdsToCleanup); - for (const Qt3DCore::QNodeId textureCleanedUpId : cleanedUpTextureIds) + for (const Qt3DCore::QNodeId &textureCleanedUpId : cleanedUpTextureIds) cleanupTexture(textureCleanedUpId); // Abandon GL shaders when a Shader node is destroyed Note: We are sure @@ -2971,7 +2971,7 @@ void Renderer::cleanGraphicsResources() // shader nodes updated const QList<Qt3DCore::QNodeId> cleanedUpShaderIds = m_nodesManager->shaderManager()->takeShaderIdsToCleanup(); - for (const Qt3DCore::QNodeId shaderCleanedUpId : cleanedUpShaderIds) { + for (const Qt3DCore::QNodeId &shaderCleanedUpId : cleanedUpShaderIds) { cleanupShader(m_nodesManager->shaderManager()->lookupResource(shaderCleanedUpId)); // We can really release the texture at this point m_nodesManager->shaderManager()->releaseResource(shaderCleanedUpId); @@ -2983,7 +2983,7 @@ void Renderer::cleanGraphicsResources() const QList<Qt3DCore::QNodeId> cleanedUpRenderTargetIds = m_nodesManager->renderTargetManager()->takeRenderTargetIdsToCleanup(); - for (const Qt3DCore::QNodeId renderTargetCleanedUpId : cleanedUpRenderTargetIds) { + for (const Qt3DCore::QNodeId &renderTargetCleanedUpId : cleanedUpRenderTargetIds) { cleanupRenderTarget(renderTargetCleanedUpId); m_nodesManager->renderTargetManager()->releaseResource(renderTargetCleanedUpId); // Release pipelines that were referencing renderTarget diff --git a/src/plugins/renderers/rhi/renderer/rhishader.cpp b/src/plugins/renderers/rhi/renderer/rhishader.cpp index 466b1d7aa..7ac40b2b0 100644 --- a/src/plugins/renderers/rhi/renderer/rhishader.cpp +++ b/src/plugins/renderers/rhi/renderer/rhishader.cpp @@ -94,25 +94,6 @@ const std::vector<QByteArray> &RHIShader::shaderCode() const } namespace { -static constexpr QRhiVertexInputAttribute::Format -rhiInputType(QShaderDescription::VariableType type) -{ - switch (type) { - case QShaderDescription::Vec4: - return QRhiVertexInputAttribute::Float4; - case QShaderDescription::Vec3: - return QRhiVertexInputAttribute::Float3; - case QShaderDescription::Vec2: - return QRhiVertexInputAttribute::Float2; - case QShaderDescription::Float: - return QRhiVertexInputAttribute::Float; - default: - // TODO UNormByte4, UNormByte2, UNormByte - RHI_UNIMPLEMENTED; - return QRhiVertexInputAttribute::UNormByte; - break; - } -} static constexpr int rhiTypeSize(QShaderDescription::VariableType type) { diff --git a/src/plugins/sceneparsers/gltf/gltfimporter.cpp b/src/plugins/sceneparsers/gltf/gltfimporter.cpp index a03afec59..6cf84f89e 100644 --- a/src/plugins/sceneparsers/gltf/gltfimporter.cpp +++ b/src/plugins/sceneparsers/gltf/gltfimporter.cpp @@ -495,7 +495,7 @@ Qt3DCore::QEntity* GLTFImporter::node(const QString &id) } } else { const auto meshes = meshesValue.toArray(); - for (const QJsonValue &mesh : meshes) { + for (const QJsonValue mesh : meshes) { const QString meshName = mesh.toString(); const auto geometryRenderers = qAsConst(m_meshDict).equal_range(meshName); if (Q_UNLIKELY(geometryRenderers.first == geometryRenderers.second)) { @@ -556,7 +556,7 @@ Qt3DCore::QEntity* GLTFImporter::node(const QString &id) // recursively retrieve children const auto children = jsonObj.value(KEY_CHILDREN).toArray(); - for (const QJsonValue &c : children) { + for (const QJsonValue c : children) { QEntity* child = node((m_majorVersion > 1) ? QString::number(c.toInt()) : c.toString()); if (!child) continue; @@ -660,7 +660,7 @@ Qt3DCore::QEntity* GLTFImporter::scene(const QString &id) const QJsonObject sceneObj = sceneVal.toObject(); sceneEntity = new QEntity; const auto nodes = sceneObj.value(KEY_NODES).toArray(); - for (const QJsonValue &n : nodes) { + for (const QJsonValue n : nodes) { QEntity* child = node(QString::number(n.toInt())); if (!child) continue; @@ -679,7 +679,7 @@ Qt3DCore::QEntity* GLTFImporter::scene(const QString &id) const QJsonObject sceneObj = sceneVal.toObject(); sceneEntity = new QEntity; const auto nodes = sceneObj.value(KEY_NODES).toArray(); - for (const QJsonValue &nnv : nodes) { + for (const QJsonValue nnv : nodes) { QString nodeName = nnv.toString(); QEntity* child = node(nodeName); if (!child) @@ -1680,7 +1680,7 @@ void GLTFImporter::processJSONTechnique(const QString &id, const QJsonObject &js t->graphicsApiFilter()->setVendor(gabifilter.value(KEY_VENDOR).toString()); QStringList extensionList; QJsonArray extArray = gabifilter.value(KEY_EXTENSIONS).toArray(); - for (const QJsonValue &extValue : extArray) + for (const QJsonValue extValue : extArray) extensionList << extValue.toString(); t->graphicsApiFilter()->setExtensions(extensionList); @@ -1698,7 +1698,7 @@ void GLTFImporter::processJSONTechnique(const QString &id, const QJsonObject &js // Render passes const QJsonArray passArray = jsonObject.value(KEY_RENDERPASSES).toArray(); - for (const QJsonValue &passValue : passArray) { + for (const QJsonValue passValue : passArray) { const QString passName = passValue.toString(); QRenderPass *pass = m_renderPasses.value(passName); if (pass) { @@ -1725,7 +1725,7 @@ void GLTFImporter::processJSONMesh(const QString &id, const QJsonObject &json) if (meshType.isEmpty()) { // Custom mesh const QJsonArray primitivesArray = json.value(KEY_PRIMITIVES).toArray(); - for (const QJsonValue &primitiveValue : primitivesArray) { + for (const QJsonValue primitiveValue : primitivesArray) { const QJsonObject primitiveObject = primitiveValue.toObject(); const QJsonValue type = primitiveObject.value(KEY_MODE); const QJsonValue matValue = primitiveObject.value(KEY_MATERIAL); @@ -1855,8 +1855,8 @@ void GLTFImporter::processJSONMesh(const QString &id, const QJsonObject &json) target->setProperty(propName.constData(), QVariant(size)); } } else { - const QVariant::Type propType = target->property(propName.constData()).type(); - if (propType == QVariant::Int) { + const QMetaType propType = target->property(propName.constData()).metaType(); + if (propType.id() == QMetaType::Int) { target->setProperty(propName.constData(), QVariant(it.value().toInt())); } else { target->setProperty(propName.constData(), @@ -2017,7 +2017,7 @@ void GLTFImporter::processJSONEffect(const QString &id, const QJsonObject &jsonO effect->addParameter(buildParameter(it.key(), it.value().toObject())); const QJsonArray techArray = jsonObject.value(KEY_TECHNIQUES).toArray(); - for (const QJsonValue &techValue : techArray) { + for (const QJsonValue techValue : techArray) { const QString techName = techValue.toString(); QTechnique *tech = m_techniques.value(techName); if (tech) { @@ -2513,7 +2513,7 @@ void GLTFImporter::populateRenderStates(QRenderPass *pass, const QJsonObject &st // Process states to enable const QJsonArray enableStatesArray = states.value(KEY_ENABLE).toArray(); QList<int> enableStates; - for (const QJsonValue &enableValue : enableStatesArray) + for (const QJsonValue enableValue : enableStatesArray) enableStates.append(enableValue.toInt()); // Process the list of state functions diff --git a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp index a8eb10116..664ac39ae 100644 --- a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp +++ b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp @@ -662,7 +662,7 @@ void GLTFExporter::parseMaterials() if (material->effect()) { QList<QParameter *> parameters = material->effect()->parameters(); for (auto param : parameters) { - if (param->value().type() == QVariant::Color) { + if (param->value().metaType().id() == QMetaType::QColor) { QColor color = param->value().value<QColor>(); if (param->name() == MATERIAL_AMBIENT_COLOR) { matInfo.colors.insert(QStringLiteral("ambient"), color); @@ -956,8 +956,8 @@ void GLTFExporter::parseMeshes() qUtf16PrintableImpl(meshInfo.name), qUtf16PrintableImpl(meshInfo.originalName)); qCDebug(GLTFExporterLog, " Vertex count: %i", vertexCount); qCDebug(GLTFExporterLog, " Bytes per vertex: %i", stride); - qCDebug(GLTFExporterLog, " Vertex buffer size (bytes): %i", vertexBuf.size()); - qCDebug(GLTFExporterLog, " Index buffer size (bytes): %i", indexBuf.size()); + qCDebug(GLTFExporterLog, " Vertex buffer size (bytes): %lli", vertexBuf.size()); + qCDebug(GLTFExporterLog, " Index buffer size (bytes): %lli", indexBuf.size()); QStringList sl; const auto views = meshInfo.views; for (const auto &bv : views) @@ -976,7 +976,7 @@ void GLTFExporter::parseMeshes() m_meshInfo.insert(mesh, meshInfo); } - qCDebug(GLTFExporterLog, "Total buffer size: %i", m_buffer.size()); + qCDebug(GLTFExporterLog, "Total buffer size: %lli", m_buffer.size()); } void GLTFExporter::parseCameras() @@ -1799,7 +1799,7 @@ void GLTFExporter::exportParameter(QJsonObject &jsonObj, const QString &name, paramObj[typeStr] = GL_SAMPLER_2D; paramObj[valueStr] = m_textureIdMap.value(textureVariantToUrl(variant)); } else { - switch (QMetaType::Type(variant.type())) { + switch (variant.metaType().id()) { case QMetaType::Bool: paramObj[typeStr] = GL_BOOL; paramObj[valueStr] = variant.toBool(); @@ -2071,7 +2071,7 @@ QString GLTFExporter::textureVariantToUrl(const QVariant &var) void GLTFExporter::setVarToJSonObject(QJsonObject &jsObj, const QString &key, const QVariant &var) { - switch (QMetaType::Type(var.type())) { + switch (var.metaType().id()) { case QMetaType::Bool: jsObj[key] = var.toBool(); break; diff --git a/src/render/backend/entity_p.h b/src/render/backend/entity_p.h index 3c2f9c2b5..e83765a78 100644 --- a/src/render/backend/entity_p.h +++ b/src/render/backend/entity_p.h @@ -269,7 +269,7 @@ private: Manager *manager = m_nodeManagers->manager<Type, Manager>(); \ QList<Handle> entries; \ entries.reserve(variable.size()); \ - for (const QNodeId id : variable) \ + for (const QNodeId &id : variable) \ entries.push_back(manager->lookupHandle(id)); \ return entries; \ } \ @@ -280,7 +280,7 @@ private: Manager *manager = m_nodeManagers->manager<Type, Manager>(); \ std::vector<Type *> entries; \ entries.reserve(variable.size()); \ - for (const QNodeId id : variable) \ + for (const QNodeId &id : variable) \ entries.push_back(manager->lookupResource(id)); \ return entries; \ } \ diff --git a/src/render/backend/visitorutils_p.h b/src/render/backend/visitorutils_p.h index 824cd0ddf..cea4af2b1 100644 --- a/src/render/backend/visitorutils_p.h +++ b/src/render/backend/visitorutils_p.h @@ -132,7 +132,7 @@ void visitPrimitives(NodeManagers *manager, const GeometryProvider *renderer, Vi if (geom) { Qt3DRender::Render::Attribute *attribute = nullptr; const auto attrIds = geom->attributes(); - for (const Qt3DCore::QNodeId attrId : attrIds) { + for (const Qt3DCore::QNodeId &attrId : attrIds) { attribute = manager->lookupResource<Attribute, AttributeManager>(attrId); if (attribute){ if (!positionAttribute && attribute->name() == Qt3DCore::QAttribute::defaultPositionAttributeName()) diff --git a/src/render/framegraph/framegraphvisitor.cpp b/src/render/framegraph/framegraphvisitor.cpp index a5a47d711..7da61386a 100644 --- a/src/render/framegraph/framegraphvisitor.cpp +++ b/src/render/framegraph/framegraphvisitor.cpp @@ -96,7 +96,7 @@ void FrameGraphVisitor::visit(Render::FrameGraphNode *node) // initiate a rendering from the current camera const QList<Qt3DCore::QNodeId> fgChildIds = node->childrenIds(); - for (const Qt3DCore::QNodeId fgChildId : fgChildIds) + for (const Qt3DCore::QNodeId &fgChildId : fgChildIds) visit(m_manager->lookupNode(fgChildId)); // Leaf node - create a RenderView ready to be populated diff --git a/src/render/geometry/gltfskeletonloader.cpp b/src/render/geometry/gltfskeletonloader.cpp index 3bd96e379..9bd59f54b 100644 --- a/src/render/geometry/gltfskeletonloader.cpp +++ b/src/render/geometry/gltfskeletonloader.cpp @@ -62,7 +62,7 @@ void jsonArrayToSqt(const QJsonArray &jsonArray, Qt3DCore::Sqt &sqt) QMatrix4x4 m; float *data = m.data(); int i = 0; - for (const auto &element : jsonArray) + for (const auto element : jsonArray) *(data + i++) = static_cast<float>(element.toDouble()); decomposeQMatrix4x4(m, sqt); @@ -449,23 +449,23 @@ bool GLTFSkeletonLoader::parseGLTF2() { bool success = true; const QJsonArray buffers = m_json.object().value(KEY_BUFFERS).toArray(); - for (const auto &bufferValue : buffers) + for (const auto bufferValue : buffers) success &= processJSONBuffer(bufferValue.toObject()); const QJsonArray bufferViews = m_json.object().value(KEY_BUFFER_VIEWS).toArray(); - for (const auto &bufferViewValue : bufferViews) + for (const auto bufferViewValue : bufferViews) success &= processJSONBufferView(bufferViewValue.toObject()); const QJsonArray accessors = m_json.object().value(KEY_ACCESSORS).toArray(); - for (const auto &accessorValue : accessors) + for (const auto accessorValue : accessors) success &= processJSONAccessor(accessorValue.toObject()); const QJsonArray skins = m_json.object().value(KEY_SKINS).toArray(); - for (const auto &skinValue : skins) + for (const auto skinValue : skins) success &= processJSONSkin(skinValue.toObject()); const QJsonArray nodes = m_json.object().value(KEY_NODES).toArray(); - for (const auto &nodeValue : nodes) + for (const auto nodeValue : nodes) success &= processJSONNode(nodeValue.toObject()); setupNodeParentLinks(); diff --git a/src/render/jobs/filtercompatibletechniquejob.cpp b/src/render/jobs/filtercompatibletechniquejob.cpp index e2c22401c..c53f811f8 100644 --- a/src/render/jobs/filtercompatibletechniquejob.cpp +++ b/src/render/jobs/filtercompatibletechniquejob.cpp @@ -80,7 +80,7 @@ void FilterCompatibleTechniqueJob::run() Q_ASSERT(m_renderer->isRunning()); const std::vector<Qt3DCore::QNodeId> dirtyTechniqueIds = m_manager->takeDirtyTechniques(); - for (const Qt3DCore::QNodeId techniqueId : dirtyTechniqueIds) { + for (const Qt3DCore::QNodeId &techniqueId : dirtyTechniqueIds) { Technique *technique = m_manager->lookupResource(techniqueId); if (Q_LIKELY(technique != nullptr)) technique->setCompatibleWithRenderer((*m_renderer->contextInfo() == *technique->graphicsApiFilter())); diff --git a/src/render/jobs/filterlayerentityjob.cpp b/src/render/jobs/filterlayerentityjob.cpp index 00ed76d86..ddea1ebf7 100644 --- a/src/render/jobs/filterlayerentityjob.cpp +++ b/src/render/jobs/filterlayerentityjob.cpp @@ -81,7 +81,7 @@ void FilterLayerEntityJob::filterAcceptAnyMatchingLayers(Entity *entity, { const Qt3DCore::QNodeIdVector entityLayers = entity->layerIds(); - for (const Qt3DCore::QNodeId id : entityLayers) { + for (const Qt3DCore::QNodeId &id : entityLayers) { const bool layerAccepted = layerIds.contains(id); if (layerAccepted) { @@ -99,7 +99,7 @@ void FilterLayerEntityJob::filterAcceptAllMatchingLayers(Entity *entity, const Qt3DCore::QNodeIdVector entityLayers = entity->layerIds(); int layersAccepted = 0; - for (const Qt3DCore::QNodeId id : entityLayers) { + for (const Qt3DCore::QNodeId &id : entityLayers) { if (layerIds.contains(id)) ++layersAccepted; } @@ -118,7 +118,7 @@ void FilterLayerEntityJob::filterDiscardAnyMatchingLayers(Entity *entity, const Qt3DCore::QNodeIdVector entityLayers = entity->layerIds(); bool entityCanBeDiscarded = false; - for (const Qt3DCore::QNodeId id : entityLayers) { + for (const Qt3DCore::QNodeId &id : entityLayers) { if (layerIds.contains(id)) { entityCanBeDiscarded = true; break; @@ -140,7 +140,7 @@ void FilterLayerEntityJob::filterDiscardAllMatchingLayers(Entity *entity, int containedLayers = 0; - for (const Qt3DCore::QNodeId id : layerIds) { + for (const Qt3DCore::QNodeId &id : layerIds) { if (entityLayers.contains(id)) ++containedLayers; } @@ -167,7 +167,7 @@ void FilterLayerEntityJob::filterLayerAndEntity() FrameGraphManager *frameGraphManager = m_manager->frameGraphManager(); LayerManager *layerManager = m_manager->layerManager(); - for (const Qt3DCore::QNodeId layerFilterId : qAsConst(m_layerFilterIds)) { + for (const Qt3DCore::QNodeId &layerFilterId : qAsConst(m_layerFilterIds)) { LayerFilterNode *layerFilter = static_cast<LayerFilterNode *>(frameGraphManager->lookupNode(layerFilterId)); Qt3DCore::QNodeIdVector layerIds = layerFilter->layerIds(); diff --git a/src/render/jobs/filterproximitydistancejob.cpp b/src/render/jobs/filterproximitydistancejob.cpp index 90978d573..3a4bf7d89 100644 --- a/src/render/jobs/filterproximitydistancejob.cpp +++ b/src/render/jobs/filterproximitydistancejob.cpp @@ -78,7 +78,7 @@ void FilterProximityDistanceJob::run() FrameGraphManager *frameGraphManager = m_manager->frameGraphManager(); EntityManager *entityManager = m_manager->renderNodesManager(); - for (const Qt3DCore::QNodeId proximityFilterId : qAsConst(m_proximityFilterIds)) { + for (const Qt3DCore::QNodeId &proximityFilterId : qAsConst(m_proximityFilterIds)) { ProximityFilter *proximityFilter = static_cast<ProximityFilter *>(frameGraphManager->lookupNode(proximityFilterId)); m_targetEntity = entityManager->lookupResource(proximityFilter->entityId()); m_distanceThresholdSquared = proximityFilter->distanceThreshold(); diff --git a/src/render/jobs/pickboundingvolumeutils.cpp b/src/render/jobs/pickboundingvolumeutils.cpp index e3a0e018a..d123b99f2 100644 --- a/src/render/jobs/pickboundingvolumeutils.cpp +++ b/src/render/jobs/pickboundingvolumeutils.cpp @@ -854,7 +854,7 @@ bool HierarchicalEntityPicker::collectHits(NodeManagers *manager, Entity *root) Qt3DCore::QNodeIdVector recursiveLayers; const Qt3DCore::QNodeIdVector entityLayers = current.entity->componentsUuid<Layer>(); - for (const Qt3DCore::QNodeId layerId : entityLayers) { + for (const Qt3DCore::QNodeId &layerId : entityLayers) { Layer *layer = layerManager->lookupResource(layerId); if (layer->recursive()) recursiveLayers << layerId; diff --git a/src/render/jobs/renderviewjobutils.cpp b/src/render/jobs/renderviewjobutils.cpp index 3677bf4cf..2e707007a 100644 --- a/src/render/jobs/renderviewjobutils.cpp +++ b/src/render/jobs/renderviewjobutils.cpp @@ -77,7 +77,7 @@ Technique *findTechniqueForEffect(NodeManagers *manager, // Iterate through the techniques in the effect const auto techniqueIds = effect->techniques(); - for (const QNodeId techniqueId : techniqueIds) { + for (const QNodeId &techniqueId : techniqueIds) { Technique *technique = manager->techniqueManager()->lookupResource(techniqueId); // Should be valid, if not there likely a problem with node addition/destruction changes @@ -117,7 +117,7 @@ RenderPassList findRenderPassesForTechnique(NodeManagers *manager, RenderPassList passes; const auto passIds = technique->renderPasses(); - for (const QNodeId passId : passIds) { + for (const QNodeId &passId : passIds) { RenderPass *renderPass = manager->renderPassManager()->lookupResource(passId); if (renderPass && renderPass->isEnabled()) { @@ -128,12 +128,12 @@ RenderPassList findRenderPassesForTechnique(NodeManagers *manager, // Iterate through the filter criteria and look for render passes with criteria that satisfy them const auto filterKeyIds = passFilter->filters(); - for (const QNodeId filterKeyId : filterKeyIds) { + for (const QNodeId &filterKeyId : filterKeyIds) { foundMatch = false; FilterKey *filterFilterKey = manager->filterKeyManager()->lookupResource(filterKeyId); const auto passFilterKeyIds = renderPass->filterKeys(); - for (const QNodeId passFilterKeyId : passFilterKeyIds) { + for (const QNodeId &passFilterKeyId : passFilterKeyIds) { FilterKey *passFilterKey = manager->filterKeyManager()->lookupResource(passFilterKeyId); if ((foundMatch = (*passFilterKey == *filterFilterKey))) break; @@ -169,7 +169,7 @@ ParameterInfoList::const_iterator findParamInfo(ParameterInfoList *params, const void addParametersForIds(ParameterInfoList *params, ParameterManager *manager, const Qt3DCore::QNodeIdVector ¶meterIds) { - for (const QNodeId paramId : parameterIds) { + for (const QNodeId ¶mId : parameterIds) { const HParameter parameterHandle = manager->lookupHandle(paramId); const Parameter *param = manager->data(parameterHandle); ParameterInfoList::iterator it = std::lower_bound(params->begin(), params->end(), param->nameId()); diff --git a/src/render/jobs/updateentitylayersjob.cpp b/src/render/jobs/updateentitylayersjob.cpp index 62b3b1c78..8f9de8ee6 100644 --- a/src/render/jobs/updateentitylayersjob.cpp +++ b/src/render/jobs/updateentitylayersjob.cpp @@ -76,7 +76,7 @@ void UpdateEntityLayersJob::run() Entity *entity = entityManager->data(handle); const Qt3DCore::QNodeIdVector entityLayers = entity->componentsUuid<Layer>(); - for (const Qt3DCore::QNodeId layerId : entityLayers) { + for (const Qt3DCore::QNodeId &layerId : entityLayers) { Layer *layer = layerManager->lookupResource(layerId); if (layer->recursive()) { // Find all children of the entity and add the layers to them diff --git a/src/render/materialsystem/filterkey.cpp b/src/render/materialsystem/filterkey.cpp index e6c37b241..c3ed62924 100644 --- a/src/render/materialsystem/filterkey.cpp +++ b/src/render/materialsystem/filterkey.cpp @@ -92,7 +92,7 @@ bool FilterKey::operator ==(const FilterKey &other) // https://codereview.qt-project.org/#/c/204484/ // and adding the following early comparison of the types should give // an equivalent performance gain: - return (other.value().type() == value().type() && + return (other.value().metaType() == value().metaType() && other.name() == name() && other.value() == value()); } diff --git a/src/render/materialsystem/qparameter.cpp b/src/render/materialsystem/qparameter.cpp index e5d586519..d4a457115 100644 --- a/src/render/materialsystem/qparameter.cpp +++ b/src/render/materialsystem/qparameter.cpp @@ -197,7 +197,7 @@ inline QVariant toBackendValue(const QVariant &v) void QParameterPrivate::setValue(const QVariant &v) { - if (v.type() == QVariant::List) { + if (v.metaType().id() == QMetaType::QVariantList) { QSequentialIterable iterable = v.value<QSequentialIterable>(); QVariantList variants; variants.reserve(iterable.size()); diff --git a/src/render/materialsystem/shaderdata.cpp b/src/render/materialsystem/shaderdata.cpp index 8b70b384f..f5e194697 100644 --- a/src/render/materialsystem/shaderdata.cpp +++ b/src/render/materialsystem/shaderdata.cpp @@ -127,7 +127,7 @@ void ShaderData::syncFromFrontEnd(const QNode *frontEnd, bool firstTime) // We check if property is a Transformed property QString transformedPropertyName; - if (propertyValue.userType() == QVariant::Vector3D) { + if (propertyValue.userType() == QMetaType::QVector3D) { // if there is a matching QShaderData::TransformType propertyTransformed transformedPropertyName = propertyName + QLatin1String("Transformed"); isTransformed = propertyNames.contains(transformedPropertyName); diff --git a/src/render/materialsystem/technique.cpp b/src/render/materialsystem/technique.cpp index bb3843d5b..4f8673c5b 100644 --- a/src/render/materialsystem/technique.cpp +++ b/src/render/materialsystem/technique.cpp @@ -176,12 +176,12 @@ bool Technique::isCompatibleWithFilters(const QNodeIdVector &filterKeyIds) // Iterate through the filter criteria and for each one search for a criteria on the // technique that satisfies it - for (const QNodeId filterKeyId : filterKeyIds) { + for (const QNodeId &filterKeyId : filterKeyIds) { FilterKey *filterKey = m_nodeManager->filterKeyManager()->lookupResource(filterKeyId); bool foundMatch = false; - for (const QNodeId techniqueFilterKeyId : qAsConst(m_filterKeyList)) { + for (const QNodeId &techniqueFilterKeyId : qAsConst(m_filterKeyList)) { FilterKey *techniqueFilterKey = m_nodeManager->filterKeyManager()->lookupResource(techniqueFilterKeyId); if ((foundMatch = (*techniqueFilterKey == *filterKey))) break; diff --git a/src/render/shadergraph/qshadergraphloader.cpp b/src/render/shadergraph/qshadergraphloader.cpp index 64f159e7b..3d95ba69c 100644 --- a/src/render/shadergraph/qshadergraphloader.cpp +++ b/src/render/shadergraph/qshadergraphloader.cpp @@ -147,7 +147,7 @@ void QShaderGraphLoader::load() } const QJsonArray nodes = nodesValue.toArray(); - for (const QJsonValue &nodeValue : nodes) { + for (const QJsonValue nodeValue : nodes) { if (!nodeValue.isObject()) { qWarning() << "Invalid node found"; hasError = true; @@ -173,9 +173,8 @@ void QShaderGraphLoader::load() const QJsonArray layersArray = nodeObject.value(QStringLiteral("layers")).toArray(); auto layers = QStringList(); - for (const QJsonValue &layerValue : layersArray) { + for (const QJsonValue layerValue : layersArray) layers.append(layerValue.toString()); - } QShaderNode node = m_prototypes.value(type); node.setUuid(uuid); @@ -189,13 +188,13 @@ void QShaderGraphLoader::load() if (parameterValue.isObject()) { const QJsonObject parameterObject = parameterValue.toObject(); const QString type = parameterObject.value(QStringLiteral("type")).toString(); - const int typeId = QMetaType::type(type.toUtf8()); + const QMetaType typeId = QMetaType::fromName(type.toUtf8()); const QString value = parameterObject.value(QStringLiteral("value")).toString(); auto variant = QVariant(value); - if (QMetaType::typeFlags(typeId) & QMetaType::IsEnumeration) { - const QMetaObject *metaObject = QMetaType::metaObjectForType(typeId); + if (typeId.flags() & QMetaType::IsEnumeration) { + const QMetaObject *metaObject = typeId.metaObject(); const char *className = metaObject->className(); const QByteArray enumName = type.mid(static_cast<int>(qstrlen(className)) + 2).toUtf8(); const QMetaEnum metaEnum = metaObject->enumerator(metaObject->indexOfEnumerator(enumName)); @@ -216,7 +215,7 @@ void QShaderGraphLoader::load() } const QJsonArray edges = edgesValue.toArray(); - for (const QJsonValue &edgeValue : edges) { + for (const QJsonValue edgeValue : edges) { if (!edgeValue.isObject()) { qWarning() << "Invalid edge found"; hasError = true; @@ -247,9 +246,8 @@ void QShaderGraphLoader::load() const QJsonArray layersArray = edgeObject.value(QStringLiteral("layers")).toArray(); auto layers = QStringList(); - for (const QJsonValue &layerValue : layersArray) { + for (const QJsonValue layerValue : layersArray) layers.append(layerValue.toString()); - } auto edge = QShaderGraph::Edge(); edge.sourceNodeUuid = sourceUuid; diff --git a/src/render/shadergraph/qshadernodesloader.cpp b/src/render/shadergraph/qshadernodesloader.cpp index df34fd1f7..f1239d749 100644 --- a/src/render/shadergraph/qshadernodesloader.cpp +++ b/src/render/shadergraph/qshadernodesloader.cpp @@ -123,7 +123,7 @@ void QShaderNodesLoader::load(const QJsonObject &prototypesObject) const QJsonValue inputsValue = nodeObject.value(QStringLiteral("inputs")); if (inputsValue.isArray()) { const QJsonArray inputsArray = inputsValue.toArray(); - for (const QJsonValue &inputValue : inputsArray) { + for (const QJsonValue inputValue : inputsArray) { if (!inputValue.isString()) { qWarning() << "Non-string value in inputs"; hasError = true; @@ -140,7 +140,7 @@ void QShaderNodesLoader::load(const QJsonObject &prototypesObject) const QJsonValue outputsValue = nodeObject.value(QStringLiteral("outputs")); if (outputsValue.isArray()) { const QJsonArray outputsArray = outputsValue.toArray(); - for (const QJsonValue &outputValue : outputsArray) { + for (const QJsonValue outputValue : outputsArray) { if (!outputValue.isString()) { qWarning() << "Non-string value in outputs"; hasError = true; @@ -162,13 +162,13 @@ void QShaderNodesLoader::load(const QJsonObject &prototypesObject) if (parameterValue.isObject()) { const QJsonObject parameterObject = parameterValue.toObject(); const QString type = parameterObject.value(QStringLiteral("type")).toString(); - const int typeId = QMetaType::type(type.toUtf8()); + const QMetaType typeId = QMetaType::fromName(type.toUtf8()); const QString value = parameterObject.value(QStringLiteral("value")).toString(); auto variant = QVariant(value); - if (QMetaType::typeFlags(typeId) & QMetaType::IsEnumeration) { - const QMetaObject *metaObject = QMetaType::metaObjectForType(typeId); + if (typeId.flags() & QMetaType::IsEnumeration) { + const QMetaObject *metaObject = typeId.metaObject(); const char *className = metaObject->className(); const QByteArray enumName = type.mid(static_cast<int>(qstrlen(className)) + 2).toUtf8(); const QMetaEnum metaEnum = metaObject->enumerator(metaObject->indexOfEnumerator(enumName)); @@ -188,7 +188,7 @@ void QShaderNodesLoader::load(const QJsonObject &prototypesObject) const QJsonValue rulesValue = nodeObject.value(QStringLiteral("rules")); if (rulesValue.isArray()) { const QJsonArray rulesArray = rulesValue.toArray(); - for (const QJsonValue &ruleValue : rulesArray) { + for (const QJsonValue ruleValue : rulesArray) { if (!ruleValue.isObject()) { qWarning() << "Rules should be objects"; hasError = true; diff --git a/tests/auto/animation/animationutils/tst_animationutils.cpp b/tests/auto/animation/animationutils/tst_animationutils.cpp index 9fe5493aa..d08183976 100644 --- a/tests/auto/animation/animationutils/tst_animationutils.cpp +++ b/tests/auto/animation/animationutils/tst_animationutils.cpp @@ -289,34 +289,34 @@ private Q_SLOTS: QLatin1String("Location"), Qt3DCore::QNodeId::createId(), "translation", - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3); const QList<ChannelMapping *> channelMappings = { channelMapping }; // Create a few channels in the format description const ChannelNameAndType rotation = { QLatin1String("Rotation"), - static_cast<int>(QVariant::Quaternion), + static_cast<int>(QMetaType::QQuaternion), 4, channelMapping->peerId() }; const ChannelNameAndType location = { QLatin1String("Location"), - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3, channelMapping->peerId() }; const ChannelNameAndType baseColor = { QLatin1String("BaseColor"), - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3, channelMapping->peerId() }; const ChannelNameAndType metalness = { QLatin1String("Metalness"), - static_cast<int>(QVariant::Double), + static_cast<int>(QMetaType::Double), 1, channelMapping->peerId() }; const ChannelNameAndType roughness = { QLatin1String("Roughness"), - static_cast<int>(QVariant::Double), + static_cast<int>(QMetaType::Double), 1, channelMapping->peerId() }; const ChannelNameAndType morphTargetWeightsList = { QLatin1String("MorphTargetWeightsList"), - static_cast<int>(QVariant::List), + static_cast<int>(QMetaType::QVariantList), 5, channelMapping->peerId() }; const ChannelNameAndType morphTargetWeightsVec = { QLatin1String("MorphTargetWeightsVec"), @@ -324,11 +324,11 @@ private Q_SLOTS: 6, channelMapping->peerId() }; const ChannelNameAndType rgbColor = { QLatin1String("rgbColor"), - static_cast<int>(QVariant::Color), + static_cast<int>(QMetaType::QColor), 3, channelMapping->peerId() }; const ChannelNameAndType rgbaColor = { QLatin1String("rgbaColor"), - static_cast<int>(QVariant::Color), + static_cast<int>(QMetaType::QColor), 4, channelMapping->peerId() }; @@ -385,42 +385,42 @@ private Q_SLOTS: QLatin1String("Location"), Qt3DCore::QNodeId::createId(), "translation", - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3); auto metalnessMapping = createChannelMapping(handler, QLatin1String("Metalness"), Qt3DCore::QNodeId::createId(), "metalness", - static_cast<int>(QVariant::Double), + static_cast<int>(QMetaType::Double), 1); auto baseColorMapping = createChannelMapping(handler, QLatin1String("BaseColor"), Qt3DCore::QNodeId::createId(), "baseColor", - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3); auto roughnessMapping = createChannelMapping(handler, QLatin1String("Roughness"), Qt3DCore::QNodeId::createId(), "roughness", - static_cast<int>(QVariant::Double), + static_cast<int>(QMetaType::Double), 1); auto rotationMapping = createChannelMapping(handler, QLatin1String("Rotation"), Qt3DCore::QNodeId::createId(), "rotation", - static_cast<int>(QVariant::Quaternion), + static_cast<int>(QMetaType::QQuaternion), 4); auto morphTargetMapping = createChannelMapping(handler, QLatin1String("MorphTargetWeights"), Qt3DCore::QNodeId::createId(), "weights", - static_cast<int>(QVariant::List), + static_cast<int>(QMetaType::QVariantList), 5); @@ -431,27 +431,27 @@ private Q_SLOTS: // Create a few channels in the format description const ChannelNameAndType rotation = { QLatin1String("Rotation"), - static_cast<int>(QVariant::Quaternion), + static_cast<int>(QMetaType::QQuaternion), 4, rotationMapping->peerId() }; const ChannelNameAndType location = { QLatin1String("Location"), - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3, locationMapping->peerId() }; const ChannelNameAndType baseColor = { QLatin1String("BaseColor"), - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3, baseColorMapping->peerId() }; const ChannelNameAndType metalness = { QLatin1String("Metalness"), - static_cast<int>(QVariant::Double), + static_cast<int>(QMetaType::Double), 1, metalnessMapping->peerId() }; const ChannelNameAndType roughness = { QLatin1String("Roughness"), - static_cast<int>(QVariant::Double), + static_cast<int>(QMetaType::Double), 1, roughnessMapping->peerId() }; const ChannelNameAndType morphTarget = { QLatin1String("MorphTargetWeights"), - static_cast<int>(QVariant::List), + static_cast<int>(QMetaType::QVariantList), 5, morphTargetMapping->peerId() }; const QList<ChannelNameAndType> channelNamesAndTypes @@ -542,7 +542,7 @@ private Q_SLOTS: QList<ChannelNameAndType> channelNamesAndTypes; for (int i = 0; i < jointCount; ++i) { ChannelNameAndType locationDescription = { QLatin1String("Location"), - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3, channelMapping->peerId() }; locationDescription.jointIndex = i; @@ -550,7 +550,7 @@ private Q_SLOTS: channelNamesAndTypes.push_back(locationDescription); ChannelNameAndType rotationDescription = { QLatin1String("Rotation"), - static_cast<int>(QVariant::Quaternion), + static_cast<int>(QMetaType::QQuaternion), 4, channelMapping->peerId() }; rotationDescription.jointIndex = i; @@ -558,7 +558,7 @@ private Q_SLOTS: channelNamesAndTypes.push_back(rotationDescription); ChannelNameAndType scaleDescription = { QLatin1String("Scale"), - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3, channelMapping->peerId() }; scaleDescription.jointIndex = i; @@ -593,21 +593,21 @@ private Q_SLOTS: MappingData locationMapping; locationMapping.targetId = channelMapping->skeletonId(); locationMapping.propertyName = "translation"; - locationMapping.type = static_cast<int>(QVariant::Vector3D); + locationMapping.type = static_cast<int>(QMetaType::QVector3D); locationMapping.channelIndices = channelComponentIndices[componentIndicesIndex++]; locationMapping.jointIndex = i; MappingData rotationMapping; rotationMapping.targetId = channelMapping->skeletonId(); rotationMapping.propertyName = "rotation"; - rotationMapping.type = static_cast<int>(QVariant::Quaternion); + rotationMapping.type = static_cast<int>(QMetaType::QQuaternion); rotationMapping.channelIndices = channelComponentIndices[componentIndicesIndex++]; rotationMapping.jointIndex = i; MappingData scaleMapping; scaleMapping.targetId = channelMapping->skeletonId(); scaleMapping.propertyName = "scale"; - scaleMapping.type = static_cast<int>(QVariant::Vector3D); + scaleMapping.type = static_cast<int>(QMetaType::QVector3D); scaleMapping.channelIndices = channelComponentIndices[componentIndicesIndex++]; scaleMapping.jointIndex = i; @@ -809,7 +809,7 @@ private Q_SLOTS: MappingData mapping; mapping.targetId = Qt3DCore::QNodeId::createId(); mapping.propertyName = "translation"; - mapping.type = static_cast<int>(QVariant::Vector3D); + mapping.type = static_cast<int>(QMetaType::QVector3D); mapping.channelIndices = QList<int> { 0, 1, 2 }; mappingData.push_back(mapping); channelResults = QList<float> { 1.0f, 2.0f, 3.0f }; @@ -837,14 +837,14 @@ private Q_SLOTS: MappingData translationMapping; translationMapping.targetId = Qt3DCore::QNodeId::createId(); translationMapping.propertyName = "translation"; - translationMapping.type = static_cast<int>(QVariant::Vector3D); + translationMapping.type = static_cast<int>(QMetaType::QVector3D); translationMapping.channelIndices = QList<int> { 0, 1, 2 }; mappingData.push_back(translationMapping); MappingData scaleMapping; scaleMapping.targetId = Qt3DCore::QNodeId::createId(); scaleMapping.propertyName = "scale"; - scaleMapping.type = static_cast<int>(QVariant::Vector3D); + scaleMapping.type = static_cast<int>(QMetaType::QVector3D); scaleMapping.channelIndices = QList<int> { 3, 4, 5 }; mappingData.push_back(scaleMapping); @@ -875,7 +875,7 @@ private Q_SLOTS: MappingData mapping; mapping.targetId = Qt3DCore::QNodeId::createId(); mapping.propertyName = "mass"; - mapping.type = static_cast<int>(QVariant::Double); + mapping.type = static_cast<int>(QMetaType::Double); mapping.channelIndices = QList<int> { 0 }; mappingData.push_back(mapping); channelResults = QList<float> { 3.5f }; @@ -897,7 +897,7 @@ private Q_SLOTS: MappingData mapping; mapping.targetId = Qt3DCore::QNodeId::createId(); mapping.propertyName = "pos"; - mapping.type = static_cast<int>(QVariant::Vector2D); + mapping.type = static_cast<int>(QMetaType::QVector2D); mapping.channelIndices = QList<int> { 0, 1 }; mappingData.push_back(mapping); channelResults = QList<float> { 2.0f, 1.0f }; @@ -919,7 +919,7 @@ private Q_SLOTS: MappingData mapping; mapping.targetId = Qt3DCore::QNodeId::createId(); mapping.propertyName = "foo"; - mapping.type = static_cast<int>(QVariant::Vector4D); + mapping.type = static_cast<int>(QMetaType::QVector4D); mapping.channelIndices = QList<int> { 0, 1, 2, 3 }; mappingData.push_back(mapping); channelResults = QList<float> { 4.0f, 3.0f, 2.0f, 1.0f }; @@ -941,7 +941,7 @@ private Q_SLOTS: MappingData mapping; mapping.targetId = Qt3DCore::QNodeId::createId(); mapping.propertyName = "rotation"; - mapping.type = static_cast<int>(QVariant::Quaternion); + mapping.type = static_cast<int>(QMetaType::QQuaternion); mapping.channelIndices = QList<int> { 0, 1, 2, 3 }; mappingData.push_back(mapping); channelResults = QList<float> { 1.0f, 0.0f, 0.0f, 1.0f }; @@ -963,7 +963,7 @@ private Q_SLOTS: MappingData mapping; mapping.targetId = Qt3DCore::QNodeId::createId(); mapping.propertyName = "color"; - mapping.type = static_cast<int>(QVariant::Color); + mapping.type = static_cast<int>(QMetaType::QColor); mapping.channelIndices = QList<int> { 0, 1, 2 }; mappingData.push_back(mapping); channelResults = QList<float> { 0.5f, 0.4f, 0.3f }; @@ -985,7 +985,7 @@ private Q_SLOTS: MappingData mapping; mapping.targetId = Qt3DCore::QNodeId::createId(); mapping.propertyName = "color"; - mapping.type = static_cast<int>(QVariant::Color); + mapping.type = static_cast<int>(QMetaType::QColor); mapping.channelIndices = QList<int> { 0, 1, 2, 3 }; mappingData.push_back(mapping); channelResults = QList<float> { 0.5f, 0.4f, 0.3f, 0.2f }; @@ -1007,7 +1007,7 @@ private Q_SLOTS: MappingData mapping; mapping.targetId = Qt3DCore::QNodeId::createId(); mapping.propertyName = "weights"; - mapping.type = static_cast<int>(QVariant::List); + mapping.type = static_cast<int>(QMetaType::QVariantList); mapping.channelIndices = QList<int> { 0, 1, 2, 3, 4, 5, 6 }; mappingData.push_back(mapping); channelResults = QList<float> { 0.5f, 0.4f, 0.3f, 0.0f, 1.0f, 0.6f, 0.9f }; @@ -1066,7 +1066,7 @@ private Q_SLOTS: MappingData mapping; mapping.targetId = Qt3DCore::QNodeId::createId(); mapping.propertyName = "translation"; - mapping.type = static_cast<int>(QVariant::Vector3D); + mapping.type = static_cast<int>(QMetaType::QVector3D); mapping.channelIndices = QList<int> { 0, 1, 2 }; mapping.callback = &callback; mapping.callbackFlags = {}; @@ -1092,7 +1092,7 @@ private Q_SLOTS: MappingData mapping; mapping.targetId = Qt3DCore::QNodeId::createId(); mapping.propertyName = "something"; - mapping.type = static_cast<int>(QVariant::Double); + mapping.type = static_cast<int>(QMetaType::Double); mapping.channelIndices = QList<int> { 0 }; mapping.callback = &callback; mapping.callbackFlags = {}; @@ -1425,7 +1425,7 @@ private Q_SLOTS: channel.channelComponents.resize(3); // leave 'name' empty - dataType = static_cast<int>(QVariant::Vector3D); + dataType = static_cast<int>(QMetaType::QVector3D); expectedChannelComponentCount = 3; offset = 0; // suffixes expected to be ignored @@ -1454,7 +1454,7 @@ private Q_SLOTS: channel.channelComponents[1].name = QLatin1String("Location Y"); channel.channelComponents[2].name = QLatin1String("Location Z"); - dataType = static_cast<int>(QVariant::Vector3D); + dataType = static_cast<int>(QMetaType::QVector3D); expectedChannelComponentCount = 3; offset = 0; suffixes = QList<char> { 'X', 'Y', 'Z', 'W' }; @@ -1484,7 +1484,7 @@ private Q_SLOTS: channel.channelComponents[0].name = QLatin1String("pos X"); channel.channelComponents[1].name = QLatin1String("pos Y"); - dataType = static_cast<int>(QVariant::Vector2D); + dataType = static_cast<int>(QMetaType::QVector2D); expectedChannelComponentCount = 2; offset = 0; suffixes = QList<char> { 'X', 'Y', 'Z', 'W' }; @@ -1516,7 +1516,7 @@ private Q_SLOTS: channel.channelComponents[2].name = QLatin1String("foo Z"); channel.channelComponents[3].name = QLatin1String("foo W"); - dataType = static_cast<int>(QVariant::Vector4D); + dataType = static_cast<int>(QMetaType::QVector4D); expectedChannelComponentCount = 4; offset = 0; suffixes = QList<char> { 'X', 'Y', 'Z', 'W' }; @@ -1545,7 +1545,7 @@ private Q_SLOTS: channel.channelComponents.resize(1); channel.channelComponents[0].name = QLatin1String("Mass X"); - dataType = static_cast<int>(QVariant::Double); + dataType = static_cast<int>(QMetaType::Double); expectedChannelComponentCount = 1; offset = 0; suffixes = QList<char> { 'X', 'Y', 'Z', 'W' }; @@ -1577,7 +1577,7 @@ private Q_SLOTS: channel.channelComponents[2].name = QLatin1String("Rotation Y"); channel.channelComponents[3].name = QLatin1String("Rotation Z"); - dataType = static_cast<int>(QVariant::Quaternion); + dataType = static_cast<int>(QMetaType::QQuaternion); expectedChannelComponentCount = 4; offset = 0; suffixes = QList<char> { 'W', 'X', 'Y', 'Z' }; @@ -1609,7 +1609,7 @@ private Q_SLOTS: channel.channelComponents[2].name = QLatin1String("Rotation Z"); channel.channelComponents[3].name = QLatin1String("Rotation Y"); - dataType = static_cast<int>(QVariant::Quaternion); + dataType = static_cast<int>(QMetaType::QQuaternion); expectedChannelComponentCount = 4; offset = 0; suffixes = QList<char> { 'W', 'X', 'Y', 'Z' }; @@ -1640,7 +1640,7 @@ private Q_SLOTS: channel.channelComponents[1].name = QLatin1String("Color G"); channel.channelComponents[2].name = QLatin1String("Color B"); - dataType = static_cast<int>(QVariant::Color); + dataType = static_cast<int>(QMetaType::QColor); expectedChannelComponentCount = 3; offset = 0; suffixes = QList<char> { 'R', 'G', 'B' }; @@ -1672,7 +1672,7 @@ private Q_SLOTS: channel.channelComponents[2].name = QLatin1String("Color B"); channel.channelComponents[3].name = QLatin1String("Color A"); - dataType = static_cast<int>(QVariant::Color); + dataType = static_cast<int>(QMetaType::QColor); expectedChannelComponentCount = 4; offset = 0; suffixes = QList<char> { 'R', 'G', 'B', 'A' }; @@ -1701,7 +1701,7 @@ private Q_SLOTS: channel.channelComponents.resize(6); // leave channel component names empty - dataType = static_cast<int>(QVariant::List); + dataType = static_cast<int>(QMetaType::QVariantList); expectedChannelComponentCount = 6; offset = 0; // suffixes expected to be ignored @@ -1793,7 +1793,7 @@ private Q_SLOTS: channel.channelComponents[2].name = QLatin1String("Rotation Y"); channel.channelComponents[3].name = QLatin1String("Rotation Z"); - dataType = static_cast<int>(QVariant::Quaternion); + dataType = static_cast<int>(QMetaType::QQuaternion); componentCount = 4; offset = 0; expectedResults = QList<int> { 0, 1, 2, 3 }; @@ -1820,7 +1820,7 @@ private Q_SLOTS: channel.channelComponents[1].name = QLatin1String("Location Y"); channel.channelComponents[2].name = QLatin1String("Location Z"); - dataType = static_cast<int>(QVariant::Vector3D); + dataType = static_cast<int>(QMetaType::QVector3D); componentCount = 3; offset = 0; expectedResults = QList<int> { 0, 1, 2 }; @@ -1847,7 +1847,7 @@ private Q_SLOTS: channel.channelComponents[1].name = QLatin1String("Color G"); channel.channelComponents[2].name = QLatin1String("Color B"); - dataType = static_cast<int>(QVariant::Color); + dataType = static_cast<int>(QMetaType::QColor); componentCount = 3; offset = 0; expectedResults = QList<int> { 0, 1, 2 }; @@ -1874,7 +1874,7 @@ private Q_SLOTS: channel.channelComponents[2].name = QLatin1String("Color B"); channel.channelComponents[3].name = QLatin1String("Color A"); - dataType = static_cast<int>(QVariant::Color); + dataType = static_cast<int>(QMetaType::QColor); componentCount = 4; offset = 0; expectedResults = QList<int> { 0, 1, 2, 3 }; @@ -2648,14 +2648,14 @@ private Q_SLOTS: QLatin1String("Location"), Qt3DCore::QNodeId::createId(), "translation", - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3); auto channelMapper = createChannelMapper(handler, QList<Qt3DCore::QNodeId> { channelMapping->peerId() }); const QList<ChannelNameAndType> expectedResults = { { QLatin1String("Location"), - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3, channelMapping->peerId() } }; @@ -2669,13 +2669,13 @@ private Q_SLOTS: QLatin1String("Location"), Qt3DCore::QNodeId::createId(), "translation", - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3); auto channelMapping2 = createChannelMapping(handler, QLatin1String("Rotation"), Qt3DCore::QNodeId::createId(), "rotation", - static_cast<int>(QVariant::Quaternion), + static_cast<int>(QMetaType::QQuaternion), 4); const QList<Qt3DCore::QNodeId> channelMappingIds @@ -2684,11 +2684,11 @@ private Q_SLOTS: const QList<ChannelNameAndType> expectedResults = { { QLatin1String("Location"), - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3, channelMapping1->peerId() }, { QLatin1String("Rotation"), - static_cast<int>(QVariant::Quaternion), + static_cast<int>(QMetaType::QQuaternion), 4, channelMapping2->peerId() } }; @@ -2702,25 +2702,25 @@ private Q_SLOTS: QLatin1String("Location"), Qt3DCore::QNodeId::createId(), "translation", - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3); auto channelMapping2 = createChannelMapping(handler, QLatin1String("Rotation"), Qt3DCore::QNodeId::createId(), "rotation", - static_cast<int>(QVariant::Quaternion), + static_cast<int>(QMetaType::QQuaternion), 4); auto channelMapping3 = createChannelMapping(handler, QLatin1String("Location"), Qt3DCore::QNodeId::createId(), "translation", - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3); auto channelMapping4 = createChannelMapping(handler, QLatin1String("Location"), Qt3DCore::QNodeId::createId(), "translation", - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3); const QList<Qt3DCore::QNodeId> channelMappingIds @@ -2730,19 +2730,19 @@ private Q_SLOTS: QList<ChannelNameAndType> expectedResults = { { QLatin1String("Location"), - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3, channelMapping1->peerId() }, { QLatin1String("Rotation"), - static_cast<int>(QVariant::Quaternion), + static_cast<int>(QMetaType::QQuaternion), 4, channelMapping2->peerId() }, { QLatin1String("Location"), - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3, channelMapping3->peerId() }, { QLatin1String("Location"), - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3, channelMapping4->peerId() } }; @@ -2761,7 +2761,7 @@ private Q_SLOTS: QList<ChannelNameAndType> expectedResults; for (int i = 0; i < jointCount; ++i) { ChannelNameAndType locationDescription = { QLatin1String("Location"), - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3, channelMapping->peerId() }; locationDescription.jointIndex = i; @@ -2769,7 +2769,7 @@ private Q_SLOTS: expectedResults.push_back(locationDescription); ChannelNameAndType rotationDescription = { QLatin1String("Rotation"), - static_cast<int>(QVariant::Quaternion), + static_cast<int>(QMetaType::QQuaternion), 4, channelMapping->peerId() }; rotationDescription.jointIndex = i; @@ -2777,7 +2777,7 @@ private Q_SLOTS: expectedResults.push_back(rotationDescription); ChannelNameAndType scaleDescription = { QLatin1String("Scale"), - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3, channelMapping->peerId() }; scaleDescription.jointIndex = i; @@ -2815,7 +2815,7 @@ private Q_SLOTS: { const QList<ChannelNameAndType> allChannels = { - { QLatin1String("Location"), static_cast<int>(QVariant::Vector3D), 3 } + { QLatin1String("Location"), static_cast<int>(QMetaType::QVector3D), 3 } }; const QList<ComponentIndices> expectedResults = { { 0, 1, 2 } }; @@ -2825,8 +2825,8 @@ private Q_SLOTS: { const QList<ChannelNameAndType> allChannels = { - { QLatin1String("Location"), static_cast<int>(QVariant::Vector3D), 3 }, - { QLatin1String("Rotation"), static_cast<int>(QVariant::Quaternion), 4 } + { QLatin1String("Location"), static_cast<int>(QMetaType::QVector3D), 3 }, + { QLatin1String("Rotation"), static_cast<int>(QMetaType::QQuaternion), 4 } }; const QList<ComponentIndices> expectedResults = { { 0, 1, 2 }, @@ -2837,12 +2837,12 @@ private Q_SLOTS: { const QList<ChannelNameAndType> allChannels = { - { QLatin1String("Location"), static_cast<int>(QVariant::Vector3D), 3 }, - { QLatin1String("Rotation"), static_cast<int>(QVariant::Quaternion), 4 }, - { QLatin1String("BaseColor"), static_cast<int>(QVariant::Vector3D), 3 }, - { QLatin1String("Metalness"), static_cast<int>(QVariant::Double), 1 }, - { QLatin1String("Roughness"), static_cast<int>(QVariant::Double), 1 }, - { QLatin1String("MorphWeights"), static_cast<int>(QVariant::List), 6 } + { QLatin1String("Location"), static_cast<int>(QMetaType::QVector3D), 3 }, + { QLatin1String("Rotation"), static_cast<int>(QMetaType::QQuaternion), 4 }, + { QLatin1String("BaseColor"), static_cast<int>(QMetaType::QVector3D), 3 }, + { QLatin1String("Metalness"), static_cast<int>(QMetaType::Double), 1 }, + { QLatin1String("Roughness"), static_cast<int>(QMetaType::Double), 1 }, + { QLatin1String("MorphWeights"), static_cast<int>(QMetaType::QVariantList), 6 } }; const QList<ComponentIndices> expectedResults = { @@ -2860,15 +2860,15 @@ private Q_SLOTS: QList<ChannelNameAndType> allChannels; const int jointCount = 4; for (int i = 0; i < jointCount; ++i) { - ChannelNameAndType locationDescription = { QLatin1String("Location"), static_cast<int>(QVariant::Vector3D), 3 }; + ChannelNameAndType locationDescription = { QLatin1String("Location"), static_cast<int>(QMetaType::QVector3D), 3 }; locationDescription.jointIndex = i; allChannels.push_back(locationDescription); - ChannelNameAndType rotationDescription = { QLatin1String("Rotation"), static_cast<int>(QVariant::Quaternion), 4 }; + ChannelNameAndType rotationDescription = { QLatin1String("Rotation"), static_cast<int>(QMetaType::QQuaternion), 4 }; rotationDescription.jointIndex = i; allChannels.push_back(rotationDescription); - ChannelNameAndType scaleDescription = { QLatin1String("Scale"), static_cast<int>(QVariant::Vector3D), 3 }; + ChannelNameAndType scaleDescription = { QLatin1String("Scale"), static_cast<int>(QMetaType::QVector3D), 3 }; scaleDescription.jointIndex = i; allChannels.push_back(scaleDescription); } @@ -2913,11 +2913,11 @@ private Q_SLOTS: { const QList<ChannelNameAndType> targetChannels = { - { QLatin1String("Rotation"), static_cast<int>(QVariant::Quaternion), 4 }, - { QLatin1String("Location"), static_cast<int>(QVariant::Vector3D), 3 }, - { QLatin1String("Base Color"), static_cast<int>(QVariant::Vector3D), 3 }, - { QLatin1String("Metalness"), static_cast<int>(QVariant::Double), 1 }, - { QLatin1String("Roughness"), static_cast<int>(QVariant::Double), 1 } + { QLatin1String("Rotation"), static_cast<int>(QMetaType::QQuaternion), 4 }, + { QLatin1String("Location"), static_cast<int>(QMetaType::QVector3D), 3 }, + { QLatin1String("Base Color"), static_cast<int>(QMetaType::QVector3D), 3 }, + { QLatin1String("Metalness"), static_cast<int>(QMetaType::Double), 1 }, + { QLatin1String("Roughness"), static_cast<int>(QMetaType::Double), 1 } }; const QList<ComponentIndices> targetIndices = { @@ -2953,11 +2953,11 @@ private Q_SLOTS: { const QList<ChannelNameAndType> targetChannels = { - { QLatin1String("Location"), static_cast<int>(QVariant::Vector3D), 3 }, - { QLatin1String("Rotation"), static_cast<int>(QVariant::Quaternion), 4 }, - { QLatin1String("Base Color"), static_cast<int>(QVariant::Vector3D), 3 }, - { QLatin1String("Metalness"), static_cast<int>(QVariant::Double), 1 }, - { QLatin1String("Roughness"), static_cast<int>(QVariant::Double), 1 } + { QLatin1String("Location"), static_cast<int>(QMetaType::QVector3D), 3 }, + { QLatin1String("Rotation"), static_cast<int>(QMetaType::QQuaternion), 4 }, + { QLatin1String("Base Color"), static_cast<int>(QMetaType::QVector3D), 3 }, + { QLatin1String("Metalness"), static_cast<int>(QMetaType::Double), 1 }, + { QLatin1String("Roughness"), static_cast<int>(QMetaType::Double), 1 } }; const QList<ComponentIndices> targetIndices = { @@ -2993,11 +2993,11 @@ private Q_SLOTS: { const QList<ChannelNameAndType> targetChannels = { - { QLatin1String("Rotation"), static_cast<int>(QVariant::Quaternion), 4 }, - { QLatin1String("Location"), static_cast<int>(QVariant::Vector3D), 3 }, - { QLatin1String("Albedo"), static_cast<int>(QVariant::Vector3D), 3 }, - { QLatin1String("Metalness"), static_cast<int>(QVariant::Double), 1 }, - { QLatin1String("Roughness"), static_cast<int>(QVariant::Double), 1 } + { QLatin1String("Rotation"), static_cast<int>(QMetaType::QQuaternion), 4 }, + { QLatin1String("Location"), static_cast<int>(QMetaType::QVector3D), 3 }, + { QLatin1String("Albedo"), static_cast<int>(QMetaType::QVector3D), 3 }, + { QLatin1String("Metalness"), static_cast<int>(QMetaType::Double), 1 }, + { QLatin1String("Roughness"), static_cast<int>(QMetaType::Double), 1 } }; const QList<ComponentIndices> targetIndices = { @@ -3033,11 +3033,11 @@ private Q_SLOTS: { const QList<ChannelNameAndType> targetChannels = { - { QLatin1String("Location"), static_cast<int>(QVariant::Vector3D), 3 }, - { QLatin1String("Rotation"), static_cast<int>(QVariant::Quaternion), 4 }, - { QLatin1String("Albedo"), static_cast<int>(QVariant::Vector3D), 3 }, - { QLatin1String("Metalness"), static_cast<int>(QVariant::Double), 1 }, - { QLatin1String("Roughness"), static_cast<int>(QVariant::Double), 1 } + { QLatin1String("Location"), static_cast<int>(QMetaType::QVector3D), 3 }, + { QLatin1String("Rotation"), static_cast<int>(QMetaType::QQuaternion), 4 }, + { QLatin1String("Albedo"), static_cast<int>(QMetaType::QVector3D), 3 }, + { QLatin1String("Metalness"), static_cast<int>(QMetaType::Double), 1 }, + { QLatin1String("Roughness"), static_cast<int>(QMetaType::Double), 1 } }; const QList<ComponentIndices> targetIndices = { @@ -3075,15 +3075,15 @@ private Q_SLOTS: QList<ChannelNameAndType> targetChannels; const int jointCount = 4; for (int i = 0; i < jointCount; ++i) { - ChannelNameAndType locationDescription = { QLatin1String("Location"), static_cast<int>(QVariant::Vector3D), 3 }; + ChannelNameAndType locationDescription = { QLatin1String("Location"), static_cast<int>(QMetaType::QVector3D), 3 }; locationDescription.jointIndex = i; targetChannels.push_back(locationDescription); - ChannelNameAndType rotationDescription = { QLatin1String("Rotation"), static_cast<int>(QVariant::Quaternion), 4 }; + ChannelNameAndType rotationDescription = { QLatin1String("Rotation"), static_cast<int>(QMetaType::QQuaternion), 4 }; rotationDescription.jointIndex = i; targetChannels.push_back(rotationDescription); - ChannelNameAndType scaleDescription = { QLatin1String("Scale"), static_cast<int>(QVariant::Vector3D), 3 }; + ChannelNameAndType scaleDescription = { QLatin1String("Scale"), static_cast<int>(QMetaType::QVector3D), 3 }; scaleDescription.jointIndex = i; targetChannels.push_back(scaleDescription); } @@ -3179,11 +3179,11 @@ private Q_SLOTS: QLatin1String("Location"), Qt3DCore::QNodeId::createId(), "translation", - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3); ChannelNameAndType channelDescription; channelDescription.mappingId = channelMapping->peerId(); - channelDescription.type = static_cast<int>(QVariant::Vector3D); + channelDescription.type = static_cast<int>(QMetaType::QVector3D); channelDescription.name = QLatin1String("translation"); const QList<float> expectedResults = { 0.0f, 0.0f, 0.0f }; QTest::newRow("translation") << handler << channelDescription << expectedResults; @@ -3195,11 +3195,11 @@ private Q_SLOTS: QLatin1String("Rotation"), Qt3DCore::QNodeId::createId(), "rotation", - static_cast<int>(QVariant::Quaternion), + static_cast<int>(QMetaType::QQuaternion), 4); ChannelNameAndType channelDescription; channelDescription.mappingId = channelMapping->peerId(); - channelDescription.type = static_cast<int>(QVariant::Quaternion); + channelDescription.type = static_cast<int>(QMetaType::QQuaternion); channelDescription.name = QLatin1String("rotation"); const QList<float> expectedResults = { 1.0f, 0.0f, 0.0f, 0.0f }; QTest::newRow("rotation") << handler << channelDescription << expectedResults; @@ -3211,11 +3211,11 @@ private Q_SLOTS: QLatin1String("Scale"), Qt3DCore::QNodeId::createId(), "scale", - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3); ChannelNameAndType channelDescription; channelDescription.mappingId = channelMapping->peerId(); - channelDescription.type = static_cast<int>(QVariant::Vector3D); + channelDescription.type = static_cast<int>(QMetaType::QVector3D); channelDescription.name = QLatin1String("scale"); const QList<float> expectedResults = { 1.0f, 1.0f, 1.0f }; QTest::newRow("scale") << handler << channelDescription << expectedResults; @@ -3230,7 +3230,7 @@ private Q_SLOTS: auto channelMapping = createChannelMapping(handler, skeleton->peerId()); ChannelNameAndType channelDescription; channelDescription.mappingId = channelMapping->peerId(); - channelDescription.type = static_cast<int>(QVariant::Vector3D); + channelDescription.type = static_cast<int>(QMetaType::QVector3D); channelDescription.jointIndex = 0; channelDescription.jointTransformComponent = Scale; const QList<float> expectedResults = { 2.0f, 3.0f, 4.0f }; @@ -3245,7 +3245,7 @@ private Q_SLOTS: auto channelMapping = createChannelMapping(handler, skeleton->peerId()); ChannelNameAndType channelDescription; channelDescription.mappingId = channelMapping->peerId(); - channelDescription.type = static_cast<int>(QVariant::Vector3D); + channelDescription.type = static_cast<int>(QMetaType::QVector3D); channelDescription.jointIndex = 0; channelDescription.jointTransformComponent = Rotation; const QList<float> expectedResults = { 1.0f, 0.0f, 0.0f, 0.0f }; @@ -3260,7 +3260,7 @@ private Q_SLOTS: auto channelMapping = createChannelMapping(handler, skeleton->peerId()); ChannelNameAndType channelDescription; channelDescription.mappingId = channelMapping->peerId(); - channelDescription.type = static_cast<int>(QVariant::Vector3D); + channelDescription.type = static_cast<int>(QMetaType::QVector3D); channelDescription.jointIndex = 0; channelDescription.jointTransformComponent = Translation; const QList<float> expectedResults = { 2.0f, 3.0f, 4.0f }; @@ -3275,7 +3275,7 @@ private Q_SLOTS: auto channelMapping = createChannelMapping(handler, skeleton->peerId()); ChannelNameAndType channelDescription; channelDescription.mappingId = channelMapping->peerId(); - channelDescription.type = static_cast<int>(QVariant::Vector3D); + channelDescription.type = static_cast<int>(QMetaType::QVector3D); channelDescription.jointIndex = 1; channelDescription.jointTransformComponent = Scale; const QList<float> expectedResults = { 20.0f, 30.0f, 40.0f }; @@ -3290,7 +3290,7 @@ private Q_SLOTS: auto channelMapping = createChannelMapping(handler, skeleton->peerId()); ChannelNameAndType channelDescription; channelDescription.mappingId = channelMapping->peerId(); - channelDescription.type = static_cast<int>(QVariant::Vector3D); + channelDescription.type = static_cast<int>(QMetaType::QVector3D); channelDescription.jointIndex = 1; channelDescription.jointTransformComponent = Rotation; const QList<float> expectedResults = { 1.0f, 0.0f, 0.0f, 0.0f }; @@ -3305,7 +3305,7 @@ private Q_SLOTS: auto channelMapping = createChannelMapping(handler, skeleton->peerId()); ChannelNameAndType channelDescription; channelDescription.mappingId = channelMapping->peerId(); - channelDescription.type = static_cast<int>(QVariant::Vector3D); + channelDescription.type = static_cast<int>(QMetaType::QVector3D); channelDescription.jointIndex = 1; channelDescription.jointTransformComponent = Translation; const QList<float> expectedResults = { 4.0f, 5.0f, 6.0f }; diff --git a/tests/auto/animation/channelmapping/tst_channelmapping.cpp b/tests/auto/animation/channelmapping/tst_channelmapping.cpp index 9bee116d4..8e4152c09 100644 --- a/tests/auto/animation/channelmapping/tst_channelmapping.cpp +++ b/tests/auto/animation/channelmapping/tst_channelmapping.cpp @@ -82,7 +82,7 @@ private Q_SLOTS: QVERIFY(qstrcmp(backendMapping.propertyName(), mapping.property().toLatin1().constData()) == 0); QVERIFY(qstrcmp(backendMapping.propertyName(), "foo") == 0); QCOMPARE(backendMapping.componentCount(), 2); - QCOMPARE(backendMapping.type(), static_cast<int>(QVariant::Vector2D)); + QCOMPARE(backendMapping.type(), static_cast<int>(QMetaType::QVector2D)); QCOMPARE(backendMapping.mappingType(), Qt3DAnimation::Animation::ChannelMapping::ChannelMappingType); // GIVEN @@ -116,7 +116,7 @@ private Q_SLOTS: QCOMPARE(backendMapping.targetId(), Qt3DCore::QNodeId()); QCOMPARE(backendMapping.propertyName(), nullptr); QCOMPARE(backendMapping.componentCount(), 0); - QCOMPARE(backendMapping.type(), static_cast<int>(QVariant::Invalid)); + QCOMPARE(backendMapping.type(), static_cast<int>(QMetaType::UnknownType)); QCOMPARE(backendMapping.skeletonId(), Qt3DCore::QNodeId()); QCOMPARE(backendMapping.mappingType(), Qt3DAnimation::Animation::ChannelMapping::ChannelMappingType); @@ -138,7 +138,7 @@ private Q_SLOTS: QCOMPARE(backendMapping.targetId(), Qt3DCore::QNodeId()); QCOMPARE(backendMapping.propertyName(), nullptr); QCOMPARE(backendMapping.componentCount(), 0); - QCOMPARE(backendMapping.type(), static_cast<int>(QVariant::Invalid)); + QCOMPARE(backendMapping.type(), static_cast<int>(QMetaType::UnknownType)); QCOMPARE(backendMapping.skeletonId(), Qt3DCore::QNodeId()); QCOMPARE(backendMapping.mappingType(), Qt3DAnimation::Animation::ChannelMapping::ChannelMappingType); } @@ -175,7 +175,7 @@ private Q_SLOTS: // THEN QCOMPARE(backendMapping.targetId(), target->id()); - QCOMPARE(backendMapping.type(), static_cast<int>(QVariant::Vector3D)); + QCOMPARE(backendMapping.type(), static_cast<int>(QMetaType::QVector3D)); QCOMPARE(backendMapping.componentCount(), 3); const char *testName = "translation"; diff --git a/tests/auto/animation/findrunningclipanimatorsjob/tst_findrunningclipanimatorsjob.cpp b/tests/auto/animation/findrunningclipanimatorsjob/tst_findrunningclipanimatorsjob.cpp index b3d6744f2..aea512f1c 100644 --- a/tests/auto/animation/findrunningclipanimatorsjob/tst_findrunningclipanimatorsjob.cpp +++ b/tests/auto/animation/findrunningclipanimatorsjob/tst_findrunningclipanimatorsjob.cpp @@ -140,7 +140,7 @@ private Q_SLOTS: QLatin1String("Location"), Qt3DCore::QNodeId::createId(), "translation", - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3); channelMapper = createChannelMapper(handler, QList<Qt3DCore::QNodeId> { channelMapping->peerId() }); animator->setMapperId(channelMapper->peerId()); @@ -181,7 +181,7 @@ private Q_SLOTS: QLatin1String("Location"), Qt3DCore::QNodeId::createId(), "translation", - static_cast<int>(QVariant::Vector3D), + static_cast<int>(QMetaType::QVector3D), 3); channelMapper = createChannelMapper(handler, QList<Qt3DCore::QNodeId> { channelMapping->peerId() }); animator->setMapperId(channelMapper->peerId()); diff --git a/tests/auto/animation/qcallbackmapping/tst_qcallbackmapping.cpp b/tests/auto/animation/qcallbackmapping/tst_qcallbackmapping.cpp index 5037937a1..c9ec159d7 100644 --- a/tests/auto/animation/qcallbackmapping/tst_qcallbackmapping.cpp +++ b/tests/auto/animation/qcallbackmapping/tst_qcallbackmapping.cpp @@ -83,7 +83,7 @@ private Q_SLOTS: { // WHEN auto newValue = new DummyCallback(); - mapping.setCallback(QVariant::Quaternion, newValue); + mapping.setCallback(QMetaType::QQuaternion, newValue); // THEN - no signals for callback QCOMPARE(mapping.callback(), newValue); @@ -117,7 +117,7 @@ private Q_SLOTS: { // WHEN auto callback = new DummyCallback(); - mapping.setCallback(QVariant::Vector3D, callback, Qt3DAnimation::QAnimationCallback::OnThreadPool); + mapping.setCallback(QMetaType::QVector3D, callback, Qt3DAnimation::QAnimationCallback::OnThreadPool); QCoreApplication::processEvents(); // THEN @@ -127,7 +127,7 @@ private Q_SLOTS: arbiter.clear(); // WHEN - mapping.setCallback(QVariant::Vector3D, callback, Qt3DAnimation::QAnimationCallback::OnThreadPool); + mapping.setCallback(QMetaType::QVector3D, callback, Qt3DAnimation::QAnimationCallback::OnThreadPool); QCoreApplication::processEvents(); // THEN diff --git a/tests/auto/animation/qchannelmapping/tst_qchannelmapping.cpp b/tests/auto/animation/qchannelmapping/tst_qchannelmapping.cpp index 10283d0d6..dd40192b8 100644 --- a/tests/auto/animation/qchannelmapping/tst_qchannelmapping.cpp +++ b/tests/auto/animation/qchannelmapping/tst_qchannelmapping.cpp @@ -95,7 +95,7 @@ private Q_SLOTS: static_cast<const Qt3DAnimation::QChannelMappingPrivate *>( Qt3DAnimation::QChannelMappingPrivate::get(&mapping)); - QCOMPARE(d->m_type, static_cast<int>(QVariant::Invalid)); + QCOMPARE(d->m_type, static_cast<int>(QMetaType::UnknownType)); QCOMPARE(d->m_componentCount, 0); } @@ -237,13 +237,13 @@ private Q_SLOTS: QTest::addColumn<int>("expectedComponentCount"); QTest::newRow("float") << QByteArrayLiteral("floatProperty") << QVariant(1.0f) << static_cast<int>(QMetaType::Float) << 1; - QTest::newRow("vec2") << QByteArrayLiteral("vec2Property") << QVariant(QVector2D(1.0f, 1.0f)) << static_cast<int>(QVariant::Vector2D) << 2; - QTest::newRow("vec3") << QByteArrayLiteral("vec3Property") << QVariant(QVector3D(1.0f, 1.0f, 1.0f)) << static_cast<int>(QVariant::Vector3D) << 3; - QTest::newRow("vec4") << QByteArrayLiteral("vec4Property") << QVariant(QVector4D(1.0f, 1.0f, 1.0f, 1.0f)) << static_cast<int>(QVariant::Vector4D) << 4; - QTest::newRow("quaternion") << QByteArrayLiteral("quaternionProperty") << QVariant(QQuaternion(1.0f, 1.0f, 1.0f, 1.0f)) << static_cast<int>(QVariant::Quaternion) << 4; + QTest::newRow("vec2") << QByteArrayLiteral("vec2Property") << QVariant(QVector2D(1.0f, 1.0f)) << static_cast<int>(QMetaType::QVector2D) << 2; + QTest::newRow("vec3") << QByteArrayLiteral("vec3Property") << QVariant(QVector3D(1.0f, 1.0f, 1.0f)) << static_cast<int>(QMetaType::QVector3D) << 3; + QTest::newRow("vec4") << QByteArrayLiteral("vec4Property") << QVariant(QVector4D(1.0f, 1.0f, 1.0f, 1.0f)) << static_cast<int>(QMetaType::QVector4D) << 4; + QTest::newRow("quaternion") << QByteArrayLiteral("quaternionProperty") << QVariant(QQuaternion(1.0f, 1.0f, 1.0f, 1.0f)) << static_cast<int>(QMetaType::QQuaternion) << 4; QVariantList list = QVariantList() << QVariant(1.0f) << QVariant(1.0) << QVariant(1.0f) << QVariant(1.0f) << QVariant(1.0f); - QTest::newRow("variantlist") << QByteArrayLiteral("listProperty") << QVariant::fromValue(list) << static_cast<int>(QVariant::List) << 5; + QTest::newRow("variantlist") << QByteArrayLiteral("listProperty") << QVariant::fromValue(list) << static_cast<int>(QMetaType::QVariantList) << 5; QList<float> vec(8); QTest::newRow("vector") << QByteArrayLiteral("vecProperty") << QVariant::fromValue(vec) << qMetaTypeId<decltype(vec)>() << 8; diff --git a/tests/auto/quick3d/quick3dbuffer/tst_quick3dbuffer.cpp b/tests/auto/quick3d/quick3dbuffer/tst_quick3dbuffer.cpp index fccf5f13f..d59040c80 100644 --- a/tests/auto/quick3d/quick3dbuffer/tst_quick3dbuffer.cpp +++ b/tests/auto/quick3d/quick3dbuffer/tst_quick3dbuffer.cpp @@ -59,7 +59,7 @@ private Q_SLOTS: QVariant data = buf.readBinaryFile(QUrl::fromLocalFile(QLatin1String("this_should_not_exist.bin"))); // THEN - QCOMPARE(data.userType(), static_cast<int>(QVariant::ByteArray)); + QCOMPARE(data.userType(), static_cast<int>(QMetaType::QByteArray)); QVERIFY(data.value<QByteArray>().isEmpty()); } @@ -80,7 +80,7 @@ private Q_SLOTS: QVariant data = buf.readBinaryFile(path); // THEN - QCOMPARE(data.userType(), static_cast<int>(QVariant::ByteArray)); + QCOMPARE(data.userType(), static_cast<int>(QMetaType::QByteArray)); const QByteArray byteArray = data.value<QByteArray>(); QCOMPARE(byteArray.size(), bufferByteSize); QVERIFY(memcmp(byteArray, dataArray.constData(), bufferByteSize) == 0); diff --git a/tests/auto/quick3d/quick3dnodeinstantiator/stringmodel.h b/tests/auto/quick3d/quick3dnodeinstantiator/stringmodel.h index b928b2ab8..d21d46831 100644 --- a/tests/auto/quick3d/quick3dnodeinstantiator/stringmodel.h +++ b/tests/auto/quick3d/quick3dnodeinstantiator/stringmodel.h @@ -84,7 +84,7 @@ public: QModelIndex index(int row, int column, const QModelIndex &parent) const override { Q_UNUSED(column); - if (row>=0 && row<rowCount(parent)) + if (row >= 0 && row < rowCount(parent)) return createIndex(row,0); else return QModelIndex(); @@ -99,7 +99,7 @@ public: { int row = index.row(); if ((row<0) || (row>=items.count())) - return QVariant::Invalid; + return int(QMetaType::UnknownType); switch (role) { case Qt::DisplayRole: diff --git a/tests/auto/quick3d/quick3dnodeinstantiator/tst_quick3dnodeinstantiator.cpp b/tests/auto/quick3d/quick3dnodeinstantiator/tst_quick3dnodeinstantiator.cpp index 76568d67d..0071a2aad 100644 --- a/tests/auto/quick3d/quick3dnodeinstantiator/tst_quick3dnodeinstantiator.cpp +++ b/tests/auto/quick3d/quick3dnodeinstantiator/tst_quick3dnodeinstantiator.cpp @@ -237,11 +237,11 @@ void tst_quick3dnodeinstantiator::createAndRemove() StringModel *model = new StringModel("model1"); engine.rootContext()->setContextProperty("model1", model); QObject *rootObject = component.create(); - QVERIFY(rootObject != 0); + QVERIFY(rootObject != nullptr); Quick3DNodeInstantiator *instantiator = qobject_cast<Quick3DNodeInstantiator*>(rootObject->findChild<QObject*>("instantiator1")); - QVERIFY(instantiator != 0); + QVERIFY(instantiator != nullptr); model->drop(1); const QList<QString> names = { "Beta", "Gamma", "Delta" }; for (int i = 0; i < 3; i++) { diff --git a/tests/auto/render/alignedresourcesmanagers-sse/tst_alignedresourcesmanagers-sse.cpp b/tests/auto/render/alignedresourcesmanagers-sse/tst_alignedresourcesmanagers-sse.cpp index 48efef4b7..a6ee70e20 100644 --- a/tests/auto/render/alignedresourcesmanagers-sse/tst_alignedresourcesmanagers-sse.cpp +++ b/tests/auto/render/alignedresourcesmanagers-sse/tst_alignedresourcesmanagers-sse.cpp @@ -75,7 +75,7 @@ private Q_SLOTS: // Shouldn't crash const std::vector<HMatrix> &activeHandles = manager.activeHandles(); - for (const HMatrix handle : activeHandles) { + for (const HMatrix &handle : activeHandles) { // WHEN Matrix4x4_SSE *mat = manager.data(handle); // THEN @@ -109,7 +109,7 @@ private Q_SLOTS: // Shouldn't crash const std::vector<HCameraLens> &activeHandles = manager.activeHandles(); - for (const HCameraLens handle : activeHandles) { + for (const HCameraLens &handle : activeHandles) { // WHEN Qt3DRender::Render::CameraLens *lens = manager.data(handle); // THEN diff --git a/tests/auto/render/gltfplugins/tst_gltfplugins.cpp b/tests/auto/render/gltfplugins/tst_gltfplugins.cpp index a167fc140..e37c1978e 100644 --- a/tests/auto/render/gltfplugins/tst_gltfplugins.cpp +++ b/tests/auto/render/gltfplugins/tst_gltfplugins.cpp @@ -788,15 +788,15 @@ void tst_gltfPlugins::compareComponents(Qt3DCore::QComponent *c1, Qt3DCore::QCom auto property = c1->metaObject()->property(i); auto v1 = c1->property(property.name()); auto v2 = c2->property(property.name()); - if (v1.type() == QVariant::Bool) { + if (v1.metaType().id() == QMetaType::Bool) { QCOMPARE(v1.toBool(), v2.toBool()); - } else if (v1.type() == QVariant::Color) { + } else if (v1.metaType().id() == QMetaType::QColor) { QCOMPARE(v1.value<QColor>(), v2.value<QColor>()); - } else if (v1.type() == QVariant::Vector3D) { + } else if (v1.metaType().id() == QMetaType::QVector3D) { QCOMPARE(v1.value<QVector3D>(), v2.value<QVector3D>()); - } else if (v1.type() == QVariant::Matrix4x4) { + } else if (v1.metaType().id() == QMetaType::QMatrix4x4) { QCOMPARE(v1.value<QMatrix4x4>(), v2.value<QMatrix4x4>()); - } else if (v1.canConvert(QMetaType::Float)) { + } else if (QMetaType::canConvert(v1.metaType(), QMetaType(QMetaType::Float))) { QVERIFY(qFuzzyCompare(v1.toFloat(), v2.toFloat())); } } @@ -878,7 +878,7 @@ void tst_gltfPlugins::compareParameters(const QList<Qt3DRender::QParameter *> &p for (auto p2 : params2) { if (p1->name() == p2->name()) { pMatch = true; - if (p1->value().type() == QVariant::Color) { + if (p1->value().metaType().id() == QMetaType::QColor) { // Colors are imported as QVector4Ds QColor color = p1->value().value<QColor>(); QVector4D vec = p2->value().value<QVector4D>(); diff --git a/tests/auto/render/opengl/filtercompatibletechniquejob/tst_filtercompatibletechniquejob.cpp b/tests/auto/render/opengl/filtercompatibletechniquejob/tst_filtercompatibletechniquejob.cpp index 8b9144c66..3a4d5f021 100644 --- a/tests/auto/render/opengl/filtercompatibletechniquejob/tst_filtercompatibletechniquejob.cpp +++ b/tests/auto/render/opengl/filtercompatibletechniquejob/tst_filtercompatibletechniquejob.cpp @@ -252,7 +252,7 @@ private Q_SLOTS: // Check at least one technique is valid bool foundValid = false; - for (const auto handle: handles) { + for (const auto &handle: handles) { Qt3DRender::Render::Technique *technique = testAspect.nodeManagers()->techniqueManager()->data(handle); foundValid |= technique->isCompatibleWithRenderer(); } diff --git a/tests/auto/render/opengl/graphicshelpergl3_2/tst_graphicshelpergl3_2.cpp b/tests/auto/render/opengl/graphicshelpergl3_2/tst_graphicshelpergl3_2.cpp index 21335e541..c21def5cd 100644 --- a/tests/auto/render/opengl/graphicshelpergl3_2/tst_graphicshelpergl3_2.cpp +++ b/tests/auto/render/opengl/graphicshelpergl3_2/tst_graphicshelpergl3_2.cpp @@ -553,9 +553,8 @@ private Q_SLOTS: textures[3]->bind(); m_func->glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, colors.data()); textures[3]->release(); - for (const QVector4D c : colors) { + for (const QVector4D &c : colors) QVERIFY(c == clearValue1); - } // WHEN const QVector4D clearValue2 = QVector4D(0.4f, 0.5f, 0.4f, 1.0f); @@ -565,9 +564,9 @@ private Q_SLOTS: textures[3]->bind(); m_func->glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, colors.data()); textures[3]->release(); - for (const QVector4D c : colors) { + for (const QVector4D &c : colors) QVERIFY(c == clearValue2); - } + // Restore m_func->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); m_func->glDeleteFramebuffers(1, &fboId); diff --git a/tests/auto/render/opengl/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp b/tests/auto/render/opengl/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp index 63a256dc0..745e3e4af 100644 --- a/tests/auto/render/opengl/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp +++ b/tests/auto/render/opengl/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp @@ -652,9 +652,8 @@ private Q_SLOTS: m_func->glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, colors.data()); textures[3]->release(); - for (const QVector4D c : colors) { + for (const QVector4D &c : colors) QVERIFY(c == clearValue1); - } // WHEN const QVector4D clearValue2 = QVector4D(0.4f, 0.5f, 0.4f, 1.0f); @@ -664,9 +663,8 @@ private Q_SLOTS: textures[3]->bind(); m_func->glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, colors.data()); textures[3]->release(); - for (const QVector4D c : colors) { + for (const QVector4D &c : colors) QVERIFY(c == clearValue2); - } // Restore m_func->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); m_func->glDeleteFramebuffers(1, &fboId); diff --git a/tests/auto/render/qray3d/tst_qray3d.cpp b/tests/auto/render/qray3d/tst_qray3d.cpp index ef0702a0a..7f8f934c6 100644 --- a/tests/auto/render/qray3d/tst_qray3d.cpp +++ b/tests/auto/render/qray3d/tst_qray3d.cpp @@ -517,8 +517,8 @@ void tst_QRay3D::properties() void tst_QRay3D::metaTypes() { int id = qMetaTypeId<Qt3DRender::RayCasting::QRay3D>(); - QVERIFY(QMetaType::type("Qt3DRender::RayCasting::QRay3D") == id); - QCOMPARE(QByteArray(QMetaType::typeName(id)), QByteArray("Qt3DRender::RayCasting::QRay3D")); + QVERIFY(QMetaType::fromName("Qt3DRender::RayCasting::QRay3D").id() == id); + QCOMPARE(QByteArray(QMetaType(id).name()), QByteArray("Qt3DRender::RayCasting::QRay3D")); QVERIFY(QMetaType::isRegistered(id)); } |