diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-11-11 16:26:04 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-11-19 10:02:26 +0100 |
commit | c761d1cafe123641fc666c53f0376bf28a2764a2 (patch) | |
tree | d81e008884770ecf350034f8339bccab9107b9c3 | |
parent | 3de37f5ae9da8b0e684ac05294475ab15ecf7009 (diff) | |
download | qt3d-c761d1cafe123641fc666c53f0376bf28a2764a2.tar.gz |
Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.
Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.
This is a 6.4 re-run of the script we ran in dev, in order to avoid
conflicts between the branches when cherry-picking.
Change-Id: I5eca3df3179dfb2b2682c75a479ba9a4259cc703
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
75 files changed, 186 insertions, 186 deletions
diff --git a/src/animation/backend/abstractevaluateclipanimatorjob.cpp b/src/animation/backend/abstractevaluateclipanimatorjob.cpp index 155854352..b196a2cde 100644 --- a/src/animation/backend/abstractevaluateclipanimatorjob.cpp +++ b/src/animation/backend/abstractevaluateclipanimatorjob.cpp @@ -52,13 +52,13 @@ void AbstractEvaluateClipAnimatorJobPrivate::postFrame(Qt3DCore::QAspectManager if (m_record.animatorId.isNull()) return; - for (auto targetData : qAsConst(m_record.targetChanges)) { + for (auto targetData : std::as_const(m_record.targetChanges)) { Qt3DCore::QNode *node = manager->lookupNode(targetData.targetId); if (node) node->setProperty(targetData.propertyName, targetData.value); } - for (auto skeletonData : qAsConst(m_record.skeletonChanges)) { + for (auto skeletonData : std::as_const(m_record.skeletonChanges)) { Qt3DCore::QAbstractSkeleton *node = qobject_cast<Qt3DCore::QAbstractSkeleton *>(manager->lookupNode(skeletonData.first)); if (node) { auto d = Qt3DCore::QAbstractSkeletonPrivate::get(node); @@ -75,7 +75,7 @@ void AbstractEvaluateClipAnimatorJobPrivate::postFrame(Qt3DCore::QAspectManager animator->setRunning(false); } - for (const AnimationCallbackAndValue &callback: qAsConst(m_callbacks)) { + for (const AnimationCallbackAndValue &callback: std::as_const(m_callbacks)) { if (callback.callback) callback.callback->valueChanged(callback.value); } diff --git a/src/animation/backend/animationclip.cpp b/src/animation/backend/animationclip.cpp index e9ef4b4a8..bf036ca0f 100644 --- a/src/animation/backend/animationclip.cpp +++ b/src/animation/backend/animationclip.cpp @@ -134,12 +134,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 : std::as_const(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 : std::as_const(m_dependingBlendedAnimators)) { BlendedClipAnimator *animator = m_handler->blendedClipAnimatorManager()->lookupResource(id); if (animator) animator->animationClipMarkedDirty(); @@ -258,7 +258,7 @@ void AnimationClip::loadAnimationFromData() // Reformat data from QAnimationClipData to backend format m_channels.resize(m_clipData.channelCount()); int i = 0; - for (const auto &frontendChannel : qAsConst(m_clipData)) + for (const auto &frontendChannel : std::as_const(m_clipData)) m_channels[i++].setFromQChannel(frontendChannel); } @@ -322,8 +322,8 @@ float AnimationClip::findDuration() { // Iterate over the contained fcurves and find the longest one float tMax = 0.f; - for (const Channel &channel : qAsConst(m_channels)) { - for (const ChannelComponent &channelComponent : qAsConst(channel.channelComponents)) { + for (const Channel &channel : std::as_const(m_channels)) { + for (const ChannelComponent &channelComponent : std::as_const(channel.channelComponents)) { const float t = channelComponent.fcurve.endTime(); if (t > tMax) tMax = t; @@ -335,7 +335,7 @@ float AnimationClip::findDuration() int AnimationClip::findChannelComponentCount() { int channelCount = 0; - for (const Channel &channel : qAsConst(m_channels)) + for (const Channel &channel : std::as_const(m_channels)) channelCount += channel.channelComponents.size(); return channelCount; } diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp index d8138145e..0892afe21 100644 --- a/src/animation/backend/animationutils.cpp +++ b/src/animation/backend/animationutils.cpp @@ -217,14 +217,14 @@ ClipResults evaluateClipAtLocalTime(AnimationClip *clip, float localTime) if (!canSlerp) { // Interpolate per component - for (const auto &channelComponent : qAsConst(channel.channelComponents)) { + for (const auto &channelComponent : std::as_const(channel.channelComponents)) { const int lowerKeyframeBound = channelComponent.fcurve.lowerKeyframeBound(localTime); channelResults[i++] = channelComponent.fcurve.evaluateAtTime(localTime, lowerKeyframeBound); } } else { // There's only one keyframe. We cant compute omega. Interpolate per component if (channel.channelComponents[0].fcurve.keyframeCount() == 1) { - for (const auto &channelComponent : qAsConst(channel.channelComponents)) + for (const auto &channelComponent : std::as_const(channel.channelComponents)) channelResults[i++] = channelComponent.fcurve.keyframe(0).value; } else { auto quaternionFromChannel = [channel](const int keyframe) { @@ -251,7 +251,7 @@ ClipResults evaluateClipAtLocalTime(AnimationClip *clip, float localTime) const auto sinHalfTheta = std::sqrt(1.0f - std::pow(cosHalfTheta,2.0f)); if (std::abs(sinHalfTheta) < ::slerpThreshold) { auto initial_i = i; - for (const auto &channelComponent : qAsConst(channel.channelComponents)) + for (const auto &channelComponent : std::as_const(channel.channelComponents)) channelResults[i++] = channelComponent.fcurve.evaluateAtTime(localTime, lowerKeyframeBound); // Normalize the resulting quaternion @@ -265,7 +265,7 @@ ClipResults evaluateClipAtLocalTime(AnimationClip *clip, float localTime) const auto reverseQ1 = cosHalfTheta < 0 ? -1.0f : 1.0f; cosHalfTheta *= reverseQ1; const auto halfTheta = std::acos(cosHalfTheta); - for (const auto &channelComponent : qAsConst(channel.channelComponents)) + for (const auto &channelComponent : std::as_const(channel.channelComponents)) channelResults[i++] = channelComponent.fcurve.evaluateAtTimeAsSlerp(localTime, lowerKeyframeBound, halfTheta, @@ -279,7 +279,7 @@ ClipResults evaluateClipAtLocalTime(AnimationClip *clip, float localTime) // If the channel is not a Rotation, apply linear interpolation per channel component // TODO How do we handle other interpolations. For exammple, color interpolation // in a linear perceptual way or other non linear spaces? - for (const auto &channelComponent : qAsConst(channel.channelComponents)) { + for (const auto &channelComponent : std::as_const(channel.channelComponents)) { const int lowerKeyframeBound = channelComponent.fcurve.lowerKeyframeBound(localTime); channelResults[i++] = channelComponent.fcurve.evaluateAtTime(localTime, lowerKeyframeBound); } @@ -730,7 +730,7 @@ ClipFormat generateClipFormatIndices(const QVector<ChannelNameAndType> &targetCh f.formattedComponentIndices.resize(channelCount); f.sourceClipMask.resize(channelCount); int indexCount = 0; - for (const auto &targetIndexVec : qAsConst(targetIndices)) + for (const auto &targetIndexVec : std::as_const(targetIndices)) indexCount += targetIndexVec.size(); ComponentIndices &sourceIndices = f.sourceClipIndices; sourceIndices.resize(indexCount); diff --git a/src/animation/backend/buildblendtreesjob.cpp b/src/animation/backend/buildblendtreesjob.cpp index b8a4f4f72..4d7eb0ebf 100644 --- a/src/animation/backend/buildblendtreesjob.cpp +++ b/src/animation/backend/buildblendtreesjob.cpp @@ -27,7 +27,7 @@ void BuildBlendTreesJob::setBlendedClipAnimators(const QVector<HBlendedClipAnima m_blendedClipAnimatorHandles = blendedClipAnimatorHandles; BlendedClipAnimatorManager *blendedClipAnimatorManager = m_handler->blendedClipAnimatorManager(); BlendedClipAnimator *blendedClipAnimator = nullptr; - for (const auto &blendedClipAnimatorHandle : qAsConst(m_blendedClipAnimatorHandles)) { + for (const auto &blendedClipAnimatorHandle : std::as_const(m_blendedClipAnimatorHandles)) { blendedClipAnimator = blendedClipAnimatorManager->data(blendedClipAnimatorHandle); Q_ASSERT(blendedClipAnimator); } @@ -37,7 +37,7 @@ void BuildBlendTreesJob::setBlendedClipAnimators(const QVector<HBlendedClipAnima // We assume that the structure of blend node tree does not change once a BlendClipAnimator has been set to running void BuildBlendTreesJob::run() { - for (const HBlendedClipAnimator &blendedClipAnimatorHandle : qAsConst(m_blendedClipAnimatorHandles)) { + for (const HBlendedClipAnimator &blendedClipAnimatorHandle : std::as_const(m_blendedClipAnimatorHandles)) { // Retrieve BlendTree node BlendedClipAnimator *blendClipAnimator = m_handler->blendedClipAnimatorManager()->data(blendedClipAnimatorHandle); Q_ASSERT(blendClipAnimator); @@ -112,7 +112,7 @@ void BuildBlendTreesJob::run() // data for that channel. Clips without data for a channel will // have default values substituted when evaluating the blend tree. int channelIndex = 0; - for (const auto &channelMask : qAsConst(format.sourceClipMask)) + for (const auto &channelMask : std::as_const(format.sourceClipMask)) blendTreeChannelMask[channelIndex++] |= channelMask; } } diff --git a/src/animation/backend/fcurve_p.h b/src/animation/backend/fcurve_p.h index b54364c87..4b5491a80 100644 --- a/src/animation/backend/fcurve_p.h +++ b/src/animation/backend/fcurve_p.h @@ -129,7 +129,7 @@ inline QDebug operator<<(QDebug dbg, const Channel &channel) dbg << "Channel Name: " << channel.name << Qt::endl << "Channels:" << channel.channelComponents.size() << Qt::endl; - for (const auto &channelComponent : qAsConst(channel.channelComponents)) { + for (const auto &channelComponent : std::as_const(channel.channelComponents)) { dbg << channelComponent; } return dbg; diff --git a/src/animation/backend/findrunningclipanimatorsjob.cpp b/src/animation/backend/findrunningclipanimatorsjob.cpp index d4381c428..ebf1d001c 100644 --- a/src/animation/backend/findrunningclipanimatorsjob.cpp +++ b/src/animation/backend/findrunningclipanimatorsjob.cpp @@ -30,7 +30,7 @@ void FindRunningClipAnimatorsJob::run() Q_ASSERT(m_handler); ClipAnimatorManager *clipAnimatorManager = m_handler->clipAnimatorManager(); - for (const auto &clipAnimatorHandle : qAsConst(m_clipAnimatorHandles)) { + for (const auto &clipAnimatorHandle : std::as_const(m_clipAnimatorHandles)) { ClipAnimator *clipAnimator = clipAnimatorManager->data(clipAnimatorHandle); Q_ASSERT(clipAnimator); if (!clipAnimator->isEnabled()) diff --git a/src/animation/backend/loadanimationclipjob.cpp b/src/animation/backend/loadanimationclipjob.cpp index 5adb66ca1..a27debd62 100644 --- a/src/animation/backend/loadanimationclipjob.cpp +++ b/src/animation/backend/loadanimationclipjob.cpp @@ -56,7 +56,7 @@ void LoadAnimationClipJob::run() d->m_updatedNodes.reserve(m_animationClipHandles.size()); AnimationClipLoaderManager *animationClipManager = m_handler->animationClipLoaderManager(); - for (const auto &animationClipHandle : qAsConst(m_animationClipHandles)) { + for (const auto &animationClipHandle : std::as_const(m_animationClipHandles)) { AnimationClip *animationClip = animationClipManager->data(animationClipHandle); Q_ASSERT(animationClip); animationClip->loadAnimation(); @@ -68,7 +68,7 @@ void LoadAnimationClipJob::run() void LoadAnimationClipJobPrivate::postFrame(Qt3DCore::QAspectManager *manager) { - for (AnimationClip *clip: qAsConst(m_updatedNodes)) { + for (AnimationClip *clip: std::as_const(m_updatedNodes)) { QAbstractAnimationClip *node = qobject_cast<QAbstractAnimationClip *>(manager->lookupNode(clip->peerId())); if (!node) continue; diff --git a/src/animation/frontend/qanimationcontroller.cpp b/src/animation/frontend/qanimationcontroller.cpp index b75599e74..06ca66925 100644 --- a/src/animation/frontend/qanimationcontroller.cpp +++ b/src/animation/frontend/qanimationcontroller.cpp @@ -149,7 +149,7 @@ float QAnimationControllerPrivate::scaledPosition(float position) const QAnimationGroup *QAnimationControllerPrivate::findGroup(const QString &name) { - for (QAnimationGroup *g : qAsConst(m_animationGroups)) { + for (QAnimationGroup *g : std::as_const(m_animationGroups)) { if (g->name() == name) return g; } @@ -178,7 +178,7 @@ void QAnimationControllerPrivate::extractAnimations() } void QAnimationControllerPrivate::clearAnimations() { - for (Qt3DAnimation::QAnimationGroup *a : qAsConst(m_animationGroups)) + for (Qt3DAnimation::QAnimationGroup *a : std::as_const(m_animationGroups)) a->deleteLater(); m_animationGroups.clear(); m_activeAnimationGroup = 0; diff --git a/src/animation/frontend/qanimationgroup.cpp b/src/animation/frontend/qanimationgroup.cpp index 8674919e2..e9a791bd4 100644 --- a/src/animation/frontend/qanimationgroup.cpp +++ b/src/animation/frontend/qanimationgroup.cpp @@ -76,7 +76,7 @@ QAnimationGroupPrivate::QAnimationGroupPrivate() void QAnimationGroupPrivate::updatePosition(float position) { m_position = position; - for (QAbstractAnimation *aa : qAsConst(m_animations)) + for (QAbstractAnimation *aa : std::as_const(m_animations)) aa->setPosition(position); } @@ -159,7 +159,7 @@ void QAnimationGroup::removeAnimation(Qt3DAnimation::QAbstractAnimation *animati d->m_animations.removeAll(animation); if (qFuzzyCompare(d->m_duration, animation->duration())) { d->m_duration = 0.0f; - for (const Qt3DAnimation::QAbstractAnimation *a : qAsConst(d->m_animations)) + for (const Qt3DAnimation::QAbstractAnimation *a : std::as_const(d->m_animations)) d->m_duration = qMax(d->m_duration, a->duration()); } } diff --git a/src/animation/frontend/qkeyframeanimation.cpp b/src/animation/frontend/qkeyframeanimation.cpp index 1e820493f..4c97c6cfd 100644 --- a/src/animation/frontend/qkeyframeanimation.cpp +++ b/src/animation/frontend/qkeyframeanimation.cpp @@ -157,7 +157,7 @@ void QKeyframeAnimation::setFramePositions(const QList<float> &positions) d->m_minposition = d->m_framePositions.first(); d->m_maxposition = d->m_framePositions.last(); float lastPos = d->m_minposition; - for (float p : qAsConst(d->m_framePositions)) { + for (float p : std::as_const(d->m_framePositions)) { if (p < lastPos || p > d->m_maxposition) qWarning() << "positions not ordered correctly"; lastPos = p; diff --git a/src/animation/frontend/qmorphinganimation.cpp b/src/animation/frontend/qmorphinganimation.cpp index af37bd2ae..dc8ba3e45 100644 --- a/src/animation/frontend/qmorphinganimation.cpp +++ b/src/animation/frontend/qmorphinganimation.cpp @@ -146,7 +146,7 @@ QMorphingAnimationPrivate::QMorphingAnimationPrivate() QMorphingAnimationPrivate::~QMorphingAnimationPrivate() { - for (QVector<float> *weights : qAsConst(m_weights)) + for (QVector<float> *weights : std::as_const(m_weights)) delete weights; } diff --git a/src/animation/frontend/qmorphtarget.cpp b/src/animation/frontend/qmorphtarget.cpp index 9151fde8e..bc0f79c16 100644 --- a/src/animation/frontend/qmorphtarget.cpp +++ b/src/animation/frontend/qmorphtarget.cpp @@ -66,7 +66,7 @@ QMorphTargetPrivate::QMorphTargetPrivate() void QMorphTargetPrivate::updateAttributeNames() { m_attributeNames.clear(); - for (const Qt3DCore::QAttribute *attr : qAsConst(m_targetAttributes)) + for (const Qt3DCore::QAttribute *attr : std::as_const(m_targetAttributes)) m_attributeNames.push_back(attr->name()); } @@ -115,7 +115,7 @@ void QMorphTarget::setAttributes(const QList<Qt3DCore::QAttribute *> &attributes void QMorphTarget::addAttribute(Qt3DCore::QAttribute *attribute) { Q_D(QMorphTarget); - for (const Qt3DCore::QAttribute *attr : qAsConst(d->m_targetAttributes)) { + for (const Qt3DCore::QAttribute *attr : std::as_const(d->m_targetAttributes)) { if (attr->name() == attribute->name()) return; } diff --git a/src/core/aspects/qabstractaspect.cpp b/src/core/aspects/qabstractaspect.cpp index 6ec014339..64a93849a 100644 --- a/src/core/aspects/qabstractaspect.cpp +++ b/src/core/aspects/qabstractaspect.cpp @@ -173,7 +173,7 @@ QBackendNodeMapperPtr QAbstractAspectPrivate::mapperForNode(const QMetaObject *m void QAbstractAspectPrivate::syncDirtyFrontEndNodes(const QList<QNode *> &nodes) { - for (auto node: qAsConst(nodes)) { + for (auto node: std::as_const(nodes)) { const QMetaObject *metaObj = QNodePrivate::get(node)->m_typeInfo; const QBackendNodeMapperPtr backendNodeMapper = mapperForNode(metaObj); @@ -205,7 +205,7 @@ void QAbstractAspectPrivate::syncDirtyEntityComponentNodes(const QList<Component return backendNodeMapper->get(node->id()); }; - for (const auto &change: qAsConst(changes)) { + for (const auto &change: std::as_const(changes)) { auto entityBackend = getBackend(change.node); if (!entityBackend) continue; diff --git a/src/core/aspects/qaspectengine.cpp b/src/core/aspects/qaspectengine.cpp index 471124c32..ee13283df 100644 --- a/src/core/aspects/qaspectengine.cpp +++ b/src/core/aspects/qaspectengine.cpp @@ -392,7 +392,7 @@ QVariant QAspectEngine::executeCommand(const QString &command) QStringList args = command.split(QLatin1Char(' ')); QString aspectName = args.takeFirst(); - for (QAbstractAspect *aspect : qAsConst(d->m_aspects)) { + for (QAbstractAspect *aspect : std::as_const(d->m_aspects)) { if (aspectName == d->m_factory.aspectName(aspect)) return aspect->executeCommand(args); } diff --git a/src/core/aspects/qaspectmanager.cpp b/src/core/aspects/qaspectmanager.cpp index d26c38fed..2b99d972a 100644 --- a/src/core/aspects/qaspectmanager.cpp +++ b/src/core/aspects/qaspectmanager.cpp @@ -131,7 +131,7 @@ void QAspectManager::enterSimulationLoop() // We are about to enter the simulation loop. Give aspects a chance to do any last // pieces of initialization qCDebug(Aspects) << "Calling onEngineStartup() for each aspect"; - for (QAbstractAspect *aspect : qAsConst(m_aspects)) { + for (QAbstractAspect *aspect : std::as_const(m_aspects)) { qCDebug(Aspects) << "\t" << aspect->objectName(); aspect->onEngineStartup(); } @@ -183,13 +183,13 @@ void QAspectManager::exitSimulationLoop() // This is because we call this function from the main thread and the // logic aspect is waiting for the main thread to execute the // QLogicComponent::onFrameUpdate() callback. - for (QAbstractAspect *aspect : qAsConst(m_aspects)) + for (QAbstractAspect *aspect : std::as_const(m_aspects)) aspect->d_func()->onEngineAboutToShutdown(); // Give aspects a chance to perform any shutdown actions. This may include unqueuing // any blocking work on the main thread that could potentially deadlock during shutdown. qCDebug(Aspects) << "Calling onEngineShutdown() for each aspect"; - for (QAbstractAspect *aspect : qAsConst(m_aspects)) { + for (QAbstractAspect *aspect : std::as_const(m_aspects)) { qCDebug(Aspects) << "\t" << aspect->objectName(); aspect->onEngineShutdown(); } @@ -259,7 +259,7 @@ void QAspectManager::setRootEntity(Qt3DCore::QEntity *root, const QList<QNode *> }); } - for (QAbstractAspect *aspect : qAsConst(m_aspects)) + for (QAbstractAspect *aspect : std::as_const(m_aspects)) aspect->d_func()->setRootAndCreateNodes(m_root, nodeTreeChanges); } } @@ -498,7 +498,7 @@ void QAspectManager::processFrame() // Buckets ensure that even if we have intermingled node added / removed // buckets, we preserve the order of the sequences - for (QAbstractAspect *aspect : qAsConst(m_aspects)) { + for (QAbstractAspect *aspect : std::as_const(m_aspects)) { switch (change.type) { case NodeTreeChange::Added: aspect->d_func()->createBackendNode(change); @@ -513,13 +513,13 @@ void QAspectManager::processFrame() // Sync node / subnode relationship changes const auto dirtySubNodes = m_changeArbiter->takeDirtyEntityComponentNodes(); if (dirtySubNodes.size()) - for (QAbstractAspect *aspect : qAsConst(m_aspects)) + for (QAbstractAspect *aspect : std::as_const(m_aspects)) QAbstractAspectPrivate::get(aspect)->syncDirtyEntityComponentNodes(dirtySubNodes); // Sync property updates const auto dirtyFrontEndNodes = m_changeArbiter->takeDirtyFrontEndNodes(); if (dirtyFrontEndNodes.size()) - for (QAbstractAspect *aspect : qAsConst(m_aspects)) + for (QAbstractAspect *aspect : std::as_const(m_aspects)) QAbstractAspectPrivate::get(aspect)->syncDirtyFrontEndNodes(dirtyFrontEndNodes); } @@ -530,7 +530,7 @@ void QAspectManager::processFrame() m_dumpJobs = false; // Tell the aspect the frame is complete (except rendering) - for (QAbstractAspect *aspect : qAsConst(m_aspects)) + for (QAbstractAspect *aspect : std::as_const(m_aspects)) aspect->frameDone(); } diff --git a/src/core/nodes/qnode.cpp b/src/core/nodes/qnode.cpp index 7034a14cf..5ba46a7c5 100644 --- a/src/core/nodes/qnode.cpp +++ b/src/core/nodes/qnode.cpp @@ -624,7 +624,7 @@ QNode::~QNode() { Q_D(QNode); // Disconnect each connection that was stored - for (const auto &nodeConnectionPair : qAsConst(d->m_destructionConnections)) + for (const auto &nodeConnectionPair : std::as_const(d->m_destructionConnections)) QObject::disconnect(nodeConnectionPair.second); d->m_destructionConnections.clear(); Q_EMIT nodeDestroyed(); diff --git a/src/core/qscheduler.cpp b/src/core/qscheduler.cpp index ecffe2612..31d01ebd5 100644 --- a/src/core/qscheduler.cpp +++ b/src/core/qscheduler.cpp @@ -108,7 +108,7 @@ int QScheduler::scheduleAndWaitForFrameAspectJobs(qint64 time, bool dumpJobs) { QTaskLogger logger(m_aspectManager->serviceLocator()->systemInformation(), 4097, 0, QTaskLogger::AspectJob); - for (auto &job : qAsConst(jobQueue)) + for (auto &job : std::as_const(jobQueue)) job->postFrame(m_aspectManager->engine()); for (QAbstractAspect *aspect : aspects) diff --git a/src/core/services/qdownloadnetworkworker.cpp b/src/core/services/qdownloadnetworkworker.cpp index 35377b8a9..7b3410364 100644 --- a/src/core/services/qdownloadnetworkworker.cpp +++ b/src/core/services/qdownloadnetworkworker.cpp @@ -55,7 +55,7 @@ void QDownloadNetworkWorker::onRequestCancelled(const QDownloadRequestPtr &reque void QDownloadNetworkWorker::onAllRequestsCancelled() { QMutexLocker l(&m_mutex); - for (auto &e: qAsConst(m_requests)) { + for (auto &e: std::as_const(m_requests)) { e.first->m_cancelled = true; e.second->abort(); } diff --git a/src/core/services/qsysteminformationservice.cpp b/src/core/services/qsysteminformationservice.cpp index 4a6c0fcfa..3ae5f76a6 100644 --- a/src/core/services/qsysteminformationservice.cpp +++ b/src/core/services/qsysteminformationservice.cpp @@ -138,12 +138,12 @@ void QSystemInformationServicePrivate::writeFrameJobLogStats() header.frameId = m_frameId; header.jobCount = 0; - for (const QList<JobRunStats> *storage : qAsConst(m_localStorages)) + for (const QList<JobRunStats> *storage : std::as_const(m_localStorages)) header.jobCount += storage->size(); m_traceFile->write(reinterpret_cast<char *>(&header), sizeof(FrameHeader)); - for (QList<JobRunStats> *storage : qAsConst(m_localStorages)) { + for (QList<JobRunStats> *storage : std::as_const(m_localStorages)) { for (const JobRunStats &stat : *storage) m_traceFile->write(reinterpret_cast<const char *>(&stat), sizeof(JobRunStats)); storage->clear(); diff --git a/src/extras/text/qtext2dentity.cpp b/src/extras/text/qtext2dentity.cpp index 393bc97f5..b0c53cb24 100644 --- a/src/extras/text/qtext2dentity.cpp +++ b/src/extras/text/qtext2dentity.cpp @@ -380,7 +380,7 @@ void QText2DEntity::setColor(const QColor &color) emit colorChanged(color); - for (DistanceFieldTextRenderer *renderer : qAsConst(d->m_renderers)) + for (DistanceFieldTextRenderer *renderer : std::as_const(d->m_renderers)) renderer->setColor(color); } } diff --git a/src/input/backend/actioninput.cpp b/src/input/backend/actioninput.cpp index 938779b8e..5080235dc 100644 --- a/src/input/backend/actioninput.cpp +++ b/src/input/backend/actioninput.cpp @@ -49,7 +49,7 @@ bool ActionInput::process(InputHandler *inputHandler, qint64 currentTime) if (!physicalDeviceBackend) return false; - for (int button : qAsConst(m_buttons)) { + for (int button : std::as_const(m_buttons)) { if (physicalDeviceBackend->isButtonPressed(button)) return true; } diff --git a/src/input/backend/assignkeyboardfocusjob.cpp b/src/input/backend/assignkeyboardfocusjob.cpp index 212fca39c..fb1771624 100644 --- a/src/input/backend/assignkeyboardfocusjob.cpp +++ b/src/input/backend/assignkeyboardfocusjob.cpp @@ -62,7 +62,7 @@ void AssignKeyboardFocusJob::run() void AssignKeyboardFocusJobPrivate::postFrame(Qt3DCore::QAspectManager *manager) { - for (const auto &data: qAsConst(updates)) { + for (const auto &data: std::as_const(updates)) { QKeyboardHandler *node = qobject_cast<QKeyboardHandler *>(manager->lookupNode(data.first)); if (!node) continue; diff --git a/src/input/backend/axisaccumulatorjob.cpp b/src/input/backend/axisaccumulatorjob.cpp index 858874827..8d5406b1f 100644 --- a/src/input/backend/axisaccumulatorjob.cpp +++ b/src/input/backend/axisaccumulatorjob.cpp @@ -53,7 +53,7 @@ void AxisAccumulatorJob::run() void AxisAccumulatorJobPrivate::postFrame(Qt3DCore::QAspectManager *manager) { - for (auto backend: qAsConst(updates)) { + for (auto backend: std::as_const(updates)) { QAxisAccumulator *node = qobject_cast<QAxisAccumulator *>(manager->lookupNode(backend->peerId())); if (!node) continue; diff --git a/src/input/backend/genericdevicebackendnode.cpp b/src/input/backend/genericdevicebackendnode.cpp index 91e82279f..c4bd2ab80 100644 --- a/src/input/backend/genericdevicebackendnode.cpp +++ b/src/input/backend/genericdevicebackendnode.cpp @@ -36,9 +36,9 @@ void GenericDeviceBackendNode::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, { const QMutexLocker lock(&m_mutex); - for (const auto &val: qAsConst(d->m_pendingAxisEvents)) + for (const auto &val: std::as_const(d->m_pendingAxisEvents)) m_axesValues[val.first] = val.second; - for (const auto &val: qAsConst(d->m_pendingButtonsEvents)) + for (const auto &val: std::as_const(d->m_pendingButtonsEvents)) m_buttonsValues[val.first] = val.second; d->m_pendingAxisEvents.clear(); diff --git a/src/input/backend/inputchord.cpp b/src/input/backend/inputchord.cpp index eadc35f6f..f0df668e5 100644 --- a/src/input/backend/inputchord.cpp +++ b/src/input/backend/inputchord.cpp @@ -74,7 +74,7 @@ bool InputChord::process(InputHandler *inputHandler, qint64 currentTime) const qint64 startTime = m_startTime; bool triggered = false; int activeInputs = 0; - for (const Qt3DCore::QNodeId &actionInputId : qAsConst(m_chords)) { + for (const Qt3DCore::QNodeId &actionInputId : std::as_const(m_chords)) { AbstractActionInput *actionInput = inputHandler->lookupActionInput(actionInputId); if (actionInput && actionInput->process(inputHandler, currentTime)) { triggered |= actionTriggered(actionInputId); diff --git a/src/input/backend/inputhandler.cpp b/src/input/backend/inputhandler.cpp index 37a174cc3..f3c407f4a 100644 --- a/src/input/backend/inputhandler.cpp +++ b/src/input/backend/inputhandler.cpp @@ -201,7 +201,7 @@ void Qt3DInput::Input::InputHandler::removeGenericDevice(HGenericDeviceBackendNo // called every frame to reset the void Qt3DInput::Input::InputHandler::resetMouseAxisState() { - for (const HMouseDevice &cHandle : qAsConst(m_activeMouseDevices)) { + for (const HMouseDevice &cHandle : std::as_const(m_activeMouseDevices)) { MouseDevice *controller = m_mouseDeviceManager->data(cHandle); controller->resetMouseAxisState(); } @@ -220,7 +220,7 @@ void InputHandler::addInputDeviceIntegration(QInputDeviceIntegration *inputInteg QAbstractPhysicalDevice *Qt3DInput::Input::InputHandler::createPhysicalDevice(const QString &name) { QAbstractPhysicalDevice *device = nullptr; - for (Qt3DInput::QInputDeviceIntegration *integration : qAsConst(m_inputDeviceIntegrations)) { + for (Qt3DInput::QInputDeviceIntegration *integration : std::as_const(m_inputDeviceIntegrations)) { if ((device = integration->createPhysicalDevice(name)) != nullptr) break; } @@ -251,7 +251,7 @@ bool InternalEventFilter::processMouseEvent(QObject *obj, QT_PREPEND_NAMESPACE(Q if (!m_inputHandler->m_scene) return false; - for (const HMouseDevice &cHandle : qAsConst(m_inputHandler->m_activeMouseDevices)) { + for (const HMouseDevice &cHandle : std::as_const(m_inputHandler->m_activeMouseDevices)) { MouseDevice *controller = m_inputHandler->m_mouseDeviceManager->data(cHandle); controller->updateMouseEvent(event); @@ -281,7 +281,7 @@ bool InternalEventFilter::processWheelEvent(QObject *obj, QT_PREPEND_NAMESPACE(Q if (!m_inputHandler->m_scene) return false; - for (const HMouseDevice &cHandle : qAsConst(m_inputHandler->m_activeMouseDevices)) { + for (const HMouseDevice &cHandle : std::as_const(m_inputHandler->m_activeMouseDevices)) { MouseDevice *controller = m_inputHandler->m_mouseDeviceManager->data(cHandle); controller->updateWheelEvent(event); @@ -311,7 +311,7 @@ bool InternalEventFilter::processKeyEvent(QObject *obj, QT_PREPEND_NAMESPACE(QKe if (!m_inputHandler->m_scene) return false; - for (const HKeyboardDevice &cHandle : qAsConst(m_inputHandler->m_activeKeyboardDevices)) { + for (const HKeyboardDevice &cHandle : std::as_const(m_inputHandler->m_activeKeyboardDevices)) { KeyboardDevice *keyboardDevice = m_inputHandler->m_keyboardDeviceManager->data(cHandle); if (keyboardDevice) { keyboardDevice->updateKeyEvent(event); diff --git a/src/input/backend/inputsequence.cpp b/src/input/backend/inputsequence.cpp index 843a88c82..b4276676b 100644 --- a/src/input/backend/inputsequence.cpp +++ b/src/input/backend/inputsequence.cpp @@ -105,7 +105,7 @@ bool InputSequence::process(InputHandler *inputHandler, qint64 currentTime) } bool triggered = false; - for (const Qt3DCore::QNodeId &actionInputId : qAsConst(m_sequences)) { + for (const Qt3DCore::QNodeId &actionInputId : std::as_const(m_sequences)) { AbstractActionInput *actionInput = inputHandler->lookupActionInput(actionInputId); if (actionInput && actionInput->process(inputHandler, currentTime)) { triggered |= actionTriggered(actionInputId, currentTime); diff --git a/src/input/backend/loadproxydevicejob.cpp b/src/input/backend/loadproxydevicejob.cpp index e500aeba6..224e166b5 100644 --- a/src/input/backend/loadproxydevicejob.cpp +++ b/src/input/backend/loadproxydevicejob.cpp @@ -62,7 +62,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 : std::as_const(m_proxies)) { PhysicalDeviceProxy *proxy = m_inputHandler->physicalDeviceProxyManager()->lookupResource(id); QAbstractPhysicalDevice *device = m_inputHandler->createPhysicalDevice(proxy->deviceName()); if (device != nullptr) @@ -72,7 +72,7 @@ void LoadProxyDeviceJob::run() void LoadProxyDeviceJobPrivate::postFrame(Qt3DCore::QAspectManager *manager) { - for (const auto &res : qAsConst(updates)) { + for (const auto &res : std::as_const(updates)) { QAbstractPhysicalDeviceProxy *node = qobject_cast<QAbstractPhysicalDeviceProxy *>(manager->lookupNode(res.first)); if (!node) continue; diff --git a/src/input/backend/qabstractphysicaldevicebackendnode.cpp b/src/input/backend/qabstractphysicaldevicebackendnode.cpp index ad6c5e8ec..8ac6c4517 100644 --- a/src/input/backend/qabstractphysicaldevicebackendnode.cpp +++ b/src/input/backend/qabstractphysicaldevicebackendnode.cpp @@ -126,13 +126,13 @@ void QAbstractPhysicalDeviceBackendNode::syncFromFrontEnd(const Qt3DCore::QNode std::inserter(removedSettings, removedSettings.end())); d->m_currentAxisSettingIds = settings; - for (const auto &axisSettingId: qAsConst(addedSettings)) { + for (const auto &axisSettingId: std::as_const(addedSettings)) { Input::AxisSetting *axisSetting = d->getAxisSetting(axisSettingId); const auto axisIds = axisSetting->axes(); for (int axisId : axisIds) d->addAxisSetting(axisId, axisSettingId); } - for (const auto &axisSettingId: qAsConst(removedSettings)) + for (const auto &axisSettingId: std::as_const(removedSettings)) d->removeAxisSetting(axisSettingId); } diff --git a/src/input/backend/updateaxisactionjob.cpp b/src/input/backend/updateaxisactionjob.cpp index dc61a8da7..a79574fe8 100644 --- a/src/input/backend/updateaxisactionjob.cpp +++ b/src/input/backend/updateaxisactionjob.cpp @@ -119,7 +119,7 @@ float UpdateAxisActionJob::processAxisInput(const Qt3DCore::QNodeId axisInputId) void UpdateAxisActionJobPrivate::postFrame(Qt3DCore::QAspectManager *manager) { - for (const auto &data: qAsConst(m_triggeredActions)) { + for (const auto &data: std::as_const(m_triggeredActions)) { Qt3DInput::QAction *action = qobject_cast<Qt3DInput::QAction *>(manager->lookupNode(data.first)); if (!action) continue; @@ -128,7 +128,7 @@ void UpdateAxisActionJobPrivate::postFrame(Qt3DCore::QAspectManager *manager) daction->setActive(data.second); } - for (const auto &data: qAsConst(m_triggeredAxis)) { + for (const auto &data: std::as_const(m_triggeredAxis)) { Qt3DInput::QAxis *axis = qobject_cast<Qt3DInput::QAxis *>(manager->lookupNode(data.first)); if (!axis) continue; diff --git a/src/input/frontend/qinputaspect.cpp b/src/input/frontend/qinputaspect.cpp index a52b7d762..f6a08d9c9 100644 --- a/src/input/frontend/qinputaspect.cpp +++ b/src/input/frontend/qinputaspect.cpp @@ -241,7 +241,7 @@ std::vector<QAspectJobPtr> QInputAspect::jobsToExecute(qint64 time) auto accumulateJob = Input::AxisAccumulatorJobPtr::create(d->m_inputHandler->axisAccumulatorManager(), d->m_inputHandler->axisManager()); accumulateJob->setDeltaTime(dt); - for (const QAspectJobPtr &job : qAsConst(axisActionJobs)) + for (const QAspectJobPtr &job : std::as_const(axisActionJobs)) accumulateJob->addDependency(job); jobs.push_back(accumulateJob); diff --git a/src/plugins/geometryloaders/default/objgeometryloader.cpp b/src/plugins/geometryloaders/default/objgeometryloader.cpp index 237f00539..264c951c3 100644 --- a/src/plugins/geometryloaders/default/objgeometryloader.cpp +++ b/src/plugins/geometryloaders/default/objgeometryloader.cpp @@ -203,7 +203,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 : std::as_const(faceIndexVector)) { const unsigned int i = faceIndexMap.value(faceIndices); m_indices.push_back(i); } diff --git a/src/plugins/geometryloaders/default/plygeometryloader.cpp b/src/plugins/geometryloaders/default/plygeometryloader.cpp index 6202a7989..54585ad75 100644 --- a/src/plugins/geometryloaders/default/plygeometryloader.cpp +++ b/src/plugins/geometryloaders/default/plygeometryloader.cpp @@ -319,7 +319,7 @@ bool PlyGeometryLoader::parseMesh(QIODevice *ioDev) break; } - for (auto &element : qAsConst(m_elements)) { + for (auto &element : std::as_const(m_elements)) { if (element.type == ElementVertex) { m_points.reserve(element.count); diff --git a/src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp b/src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp index b35e949b4..4b2c6a916 100644 --- a/src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp +++ b/src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp @@ -257,7 +257,7 @@ void GLTFGeometryLoader::processJSONBufferV2(const QJsonObject &json) void GLTFGeometryLoader::processJSONBufferView(const QString &id, const QJsonObject &json) { QString bufName = json.value(KEY_BUFFER).toString(); - const auto it = qAsConst(m_gltf1.m_bufferDatas).find(bufName); + const auto it = std::as_const(m_gltf1.m_bufferDatas).find(bufName); if (Q_UNLIKELY(it == m_gltf1.m_bufferDatas.cend())) { qCWarning(GLTFGeometryLoaderLog, "unknown buffer: %ls processing view: %ls", qUtf16PrintableImpl(bufName), qUtf16PrintableImpl(id)); @@ -353,7 +353,7 @@ void GLTFGeometryLoader::processJSONMesh(const QString &id, const QJsonObject &j const QJsonObject attrs = primitiveObject.value(KEY_ATTRIBUTES).toObject(); for (auto it = attrs.begin(), end = attrs.end(); it != end; ++it) { QString k = it.value().toString(); - const auto accessorIt = qAsConst(m_gltf1.m_accessorDict).find(k); + const auto accessorIt = std::as_const(m_gltf1.m_accessorDict).find(k); if (Q_UNLIKELY(accessorIt == m_gltf1.m_accessorDict.cend())) { qCWarning(GLTFGeometryLoaderLog, "unknown attribute accessor: %ls on mesh %ls", qUtf16PrintableImpl(k), qUtf16PrintableImpl(id)); @@ -387,7 +387,7 @@ void GLTFGeometryLoader::processJSONMesh(const QString &id, const QJsonObject &j const auto indices = primitiveObject.value(KEY_INDICES); if (!indices.isUndefined()) { QString k = indices.toString(); - const auto accessorIt = qAsConst(m_gltf1.m_accessorDict).find(k); + const auto accessorIt = std::as_const(m_gltf1.m_accessorDict).find(k); if (Q_UNLIKELY(accessorIt == m_gltf1.m_accessorDict.cend())) { qCWarning(GLTFGeometryLoaderLog, "unknown index accessor: %ls on mesh %ls", qUtf16PrintableImpl(k), qUtf16PrintableImpl(id)); @@ -504,7 +504,7 @@ void GLTFGeometryLoader::loadBufferData() void GLTFGeometryLoader::unloadBufferData() { - for (const auto &bufferData : qAsConst(m_gltf1.m_bufferDatas)) { + for (const auto &bufferData : std::as_const(m_gltf1.m_bufferDatas)) { QByteArray *data = bufferData.data; delete data; } @@ -520,7 +520,7 @@ void GLTFGeometryLoader::loadBufferDataV2() void GLTFGeometryLoader::unloadBufferDataV2() { - for (const auto &bufferData : qAsConst(m_gltf2.m_bufferDatas)) { + for (const auto &bufferData : std::as_const(m_gltf2.m_bufferDatas)) { QByteArray *data = bufferData.data; delete data; } diff --git a/src/plugins/renderers/opengl/textures/gltexture.cpp b/src/plugins/renderers/opengl/textures/gltexture.cpp index 1e6bb8ff0..f6bd38fc3 100644 --- a/src/plugins/renderers/opengl/textures/gltexture.cpp +++ b/src/plugins/renderers/opengl/textures/gltexture.cpp @@ -161,7 +161,7 @@ bool GLTexture::loadTextureDataFromGenerator() void GLTexture::loadTextureDataFromImages() { int maxMipLevel = 0; - for (const Image &img : qAsConst(m_images)) { + for (const Image &img : std::as_const(m_images)) { const QTextureImageDataPtr imgData = img.generator->operator()(); // imgData may be null in the following cases: // - Texture is created with TextureImages which have yet to be diff --git a/src/plugins/renderers/rhi/renderer/pipelineuboset.cpp b/src/plugins/renderers/rhi/renderer/pipelineuboset.cpp index f242966cf..598c32ef9 100644 --- a/src/plugins/renderers/rhi/renderer/pipelineuboset.cpp +++ b/src/plugins/renderers/rhi/renderer/pipelineuboset.cpp @@ -582,7 +582,7 @@ void PipelineUBOSet::uploadUBOsForCommand(const RenderCommand &command, if (ubo == nullptr) continue; - for (const RHIShader::UBO_Member &member : qAsConst(uboBlock.members)) { + for (const RHIShader::UBO_Member &member : std::as_const(uboBlock.members)) { const QShaderDescription::BlockVariable &blockVariable = member.blockVariable; // Array @@ -661,7 +661,7 @@ void PipelineUBOSet::uploadUBOsForCommand(const RenderCommand &command, continue; // Upload ShaderData property that match members of each UBO block instance - for (const RHIShader::UBO_Member &uboInstance : qAsConst(block->members)) { + for (const RHIShader::UBO_Member &uboInstance : std::as_const(block->members)) { uploadShaderDataProperty(shaderData, materialsUBO, uboInstance, distanceToCommand); } diff --git a/src/plugins/renderers/rhi/renderer/renderer.cpp b/src/plugins/renderers/rhi/renderer/renderer.cpp index ff785e2d5..072e8e342 100644 --- a/src/plugins/renderers/rhi/renderer/renderer.cpp +++ b/src/plugins/renderers/rhi/renderer/renderer.cpp @@ -1386,11 +1386,11 @@ Renderer::prepareCommandsSubmission(const std::vector<RenderView *> &renderViews // Note: we cannot do it in the loop above as we want to be sure that all // the VAO which reference the geometry/attributes are properly updated RHI_UNIMPLEMENTED; - for (Attribute *attribute : qAsConst(m_dirtyAttributes)) + for (Attribute *attribute : std::as_const(m_dirtyAttributes)) attribute->unsetDirty(); m_dirtyAttributes.clear(); - for (Geometry *geometry : qAsConst(m_dirtyGeometry)) + for (Geometry *geometry : std::as_const(m_dirtyGeometry)) geometry->unsetDirty(); m_dirtyGeometry.clear(); @@ -2190,7 +2190,7 @@ void Renderer::jobsDone(Qt3DCore::QAspectManager *manager) const std::vector<Qt3DCore::QNodeId> pendingCaptureIds = Qt3DCore::moveAndClear(m_pendingRenderCaptureSendRequests); lock.unlock(); - for (const Qt3DCore::QNodeId &id : qAsConst(pendingCaptureIds)) { + for (const Qt3DCore::QNodeId &id : std::as_const(pendingCaptureIds)) { auto *backend = static_cast<Qt3DRender::Render::RenderCapture *>( m_nodesManager->frameGraphManager()->lookupNode(id)); backend->syncRenderCapturesToFrontend(manager); diff --git a/src/plugins/renderers/rhi/renderer/rhishader.cpp b/src/plugins/renderers/rhi/renderer/rhishader.cpp index 378beaef8..1e6b97292 100644 --- a/src/plugins/renderers/rhi/renderer/rhishader.cpp +++ b/src/plugins/renderers/rhi/renderer/rhishader.cpp @@ -434,7 +434,7 @@ void RHIShader::introspect() std::vector<UBO_Member> uboMembers; uboMembers.reserve(ubo.members.size()); - for (const QShaderDescription::BlockVariable &member : qAsConst(ubo.members)) { + for (const QShaderDescription::BlockVariable &member : std::as_const(ubo.members)) { m_uniformsNames.push_back(member.name); const int nameId = StringToInt::lookupId(member.name); m_uniformsNamesIds.push_back(nameId); diff --git a/src/plugins/renderers/rhi/textures/texture.cpp b/src/plugins/renderers/rhi/textures/texture.cpp index e81bcb915..2fb01b39c 100644 --- a/src/plugins/renderers/rhi/textures/texture.cpp +++ b/src/plugins/renderers/rhi/textures/texture.cpp @@ -335,7 +335,7 @@ bool RHITexture::loadTextureDataFromGenerator() void RHITexture::loadTextureDataFromImages() { int maxMipLevel = 0; - for (const Image &img : qAsConst(m_images)) { + for (const Image &img : std::as_const(m_images)) { const QTextureImageDataPtr imgData = img.generator->operator()(); // imgData may be null in the following cases: // - Texture is created with TextureImages which have yet to be diff --git a/src/plugins/sceneparsers/assimp/assimpimporter.cpp b/src/plugins/sceneparsers/assimp/assimpimporter.cpp index 17a3b0199..3af127273 100644 --- a/src/plugins/sceneparsers/assimp/assimpimporter.cpp +++ b/src/plugins/sceneparsers/assimp/assimpimporter.cpp @@ -346,7 +346,7 @@ AssimpImporter::~AssimpImporter() */ bool AssimpImporter::areAssimpExtensions(const QStringList &extensions) { - for (const auto &ext : qAsConst(extensions)) + for (const auto &ext : std::as_const(extensions)) if (AssimpImporter::assimpSupportedFormatsList.contains(ext.toLower())) return true; return false; @@ -415,7 +415,7 @@ Qt3DCore::QEntity *AssimpImporter::scene(const QString &id) if (m_scene->m_animations.size() > 0) { qWarning() << "No target found for " << m_scene->m_animations.size() << " animations!"; - for (Qt3DAnimation::QKeyframeAnimation *anim : qAsConst(m_scene->m_animations)) + for (Qt3DAnimation::QKeyframeAnimation *anim : std::as_const(m_scene->m_animations)) delete anim; m_scene->m_animations.clear(); } @@ -474,7 +474,7 @@ Qt3DCore::QEntity *AssimpImporter::node(aiNode *node) animations, aiStringToQString(node->mName)); const auto morphTargetList = morphingAnimations.at(0)->morphTargetList(); - for (Qt3DAnimation::QMorphingAnimation *anim : qAsConst(animations)) { + for (Qt3DAnimation::QMorphingAnimation *anim : std::as_const(animations)) { anim->setParent(entityNode); anim->setTarget(mesh); anim->setMorphTargets(morphTargetList); @@ -531,7 +531,7 @@ Qt3DCore::QEntity *AssimpImporter::node(aiNode *node) animations, aiStringToQString(node->mName)); - for (Qt3DAnimation::QKeyframeAnimation *anim : qAsConst(animations)) { + for (Qt3DAnimation::QKeyframeAnimation *anim : std::as_const(animations)) { anim->setTarget(transform); anim->setParent(entityNode); } diff --git a/src/plugins/sceneparsers/gltf/gltfimporter.cpp b/src/plugins/sceneparsers/gltf/gltfimporter.cpp index 8fda1dd5a..69d4c8954 100644 --- a/src/plugins/sceneparsers/gltf/gltfimporter.cpp +++ b/src/plugins/sceneparsers/gltf/gltfimporter.cpp @@ -446,7 +446,7 @@ Qt3DCore::QEntity* GLTFImporter::node(const QString &id) const QJsonValue mesh = jsonObj.value(KEY_MESH); if (!mesh.isUndefined()) { const QString meshName = QString::number(mesh.toInt()); - const auto geometryRenderers = qAsConst(m_meshDict).equal_range(meshName); + const auto geometryRenderers = std::as_const(m_meshDict).equal_range(meshName); for (auto it = geometryRenderers.first; it != geometryRenderers.second; ++it) { QGeometryRenderer *geometryRenderer = it.value(); QEntity *entity = new QEntity; @@ -461,7 +461,7 @@ Qt3DCore::QEntity* GLTFImporter::node(const QString &id) const auto meshes = meshesValue.toArray(); for (const QJsonValue mesh : meshes) { const QString meshName = mesh.toString(); - const auto geometryRenderers = qAsConst(m_meshDict).equal_range(meshName); + const auto geometryRenderers = std::as_const(m_meshDict).equal_range(meshName); if (Q_UNLIKELY(geometryRenderers.first == geometryRenderers.second)) { qCWarning(GLTFImporterLog, "node %ls references unknown mesh %ls", qUtf16PrintableImpl(id), qUtf16PrintableImpl(meshName)); @@ -484,11 +484,11 @@ Qt3DCore::QEntity* GLTFImporter::node(const QString &id) case 0: break; case 1: - result = qAsConst(entities).first(); + result = std::as_const(entities).first(); break; default: result = new QEntity; - for (QEntity *entity : qAsConst(entities)) + for (QEntity *entity : std::as_const(entities)) entity->setParent(result); } } @@ -717,7 +717,7 @@ GLTFImporter::AccessorData::AccessorData(const QJsonObject &json, int major, int bool GLTFImporter::isGLTFSupported(const QStringList &extensions) { - for (auto suffix: qAsConst(extensions)) { + for (auto suffix: std::as_const(extensions)) { suffix = suffix.toLower(); if (suffix == QLatin1String("json") || suffix == QLatin1String("gltf") || suffix == QLatin1String("qgltf")) return true; @@ -816,7 +816,7 @@ QMaterial *GLTFImporter::materialWithCustomShader(const QString &id, const QJson // Default ES2 Technique QString techniqueName = jsonObj.value(KEY_TECHNIQUE).toString(); - const auto it = qAsConst(m_techniques).find(techniqueName); + const auto it = std::as_const(m_techniques).find(techniqueName); if (Q_UNLIKELY(it == m_techniques.cend())) { qCWarning(GLTFImporterLog, "unknown technique %ls for material %ls in GLTF file %ls", qUtf16PrintableImpl(techniqueName), qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath)); @@ -833,7 +833,7 @@ QMaterial *GLTFImporter::materialWithCustomShader(const QString &id, const QJson QTechnique *gl2Technique = nullptr; QString coreTechniqueName = jsonObj.value(KEY_TECHNIQUE_CORE).toString(); if (!coreTechniqueName.isNull()) { - const auto it = qAsConst(m_techniques).find(coreTechniqueName); + const auto it = std::as_const(m_techniques).find(coreTechniqueName); if (Q_UNLIKELY(it == m_techniques.cend())) { qCWarning(GLTFImporterLog, "unknown technique %ls for material %ls in GLTF file %ls", qUtf16PrintableImpl(coreTechniqueName), qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath)); @@ -848,7 +848,7 @@ QMaterial *GLTFImporter::materialWithCustomShader(const QString &id, const QJson //Optional GL2 technique QString gl2TechniqueName = jsonObj.value(KEY_TECHNIQUE_GL2).toString(); if (!gl2TechniqueName.isNull()) { - const auto it = qAsConst(m_techniques).find(gl2TechniqueName); + const auto it = std::as_const(m_techniques).find(gl2TechniqueName); if (Q_UNLIKELY(it == m_techniques.cend())) { qCWarning(GLTFImporterLog, "unknown technique %ls for material %ls in GLTF file %ls", qUtf16PrintableImpl(gl2TechniqueName), qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath)); @@ -1179,7 +1179,7 @@ QMaterial *GLTFImporter::pbrMaterial(const QJsonObject &jsonObj) QMaterial* GLTFImporter::material(const QString &id) { - const auto it = qAsConst(m_materialCache).find(id); + const auto it = std::as_const(m_materialCache).find(id); if (it != m_materialCache.cend()) return it.value(); @@ -1412,7 +1412,7 @@ void GLTFImporter::cleanup() m_shaderPaths.clear(); delete_if_without_parent(m_programs); m_programs.clear(); - for (const auto ¶ms : qAsConst(m_techniqueParameters)) + for (const auto ¶ms : std::as_const(m_techniqueParameters)) delete_if_without_parent(params); m_techniqueParameters.clear(); delete_if_without_parent(m_techniques); @@ -1455,7 +1455,7 @@ void GLTFImporter::processJSONBufferView(const QString &id, const QJsonObject& j } else { bufName = json.value(KEY_BUFFER).toString(); } - const auto it = qAsConst(m_bufferDatas).find(bufName); + const auto it = std::as_const(m_bufferDatas).find(bufName); if (Q_UNLIKELY(it == m_bufferDatas.cend())) { qCWarning(GLTFImporterLog, "unknown buffer: %ls processing view: %ls", qUtf16PrintableImpl(bufName), qUtf16PrintableImpl(id)); @@ -1511,8 +1511,8 @@ void GLTFImporter::processJSONProgram(const QString &id, const QJsonObject &json const QString fragName = jsonObject.value(KEY_FRAGMENT_SHADER).toString(); const QString vertName = jsonObject.value(KEY_VERTEX_SHADER).toString(); - const auto fragIt = qAsConst(m_shaderPaths).find(fragName); - const auto vertIt = qAsConst(m_shaderPaths).find(vertName); + const auto fragIt = std::as_const(m_shaderPaths).find(fragName); + const auto vertIt = std::as_const(m_shaderPaths).find(vertName); if (Q_UNLIKELY(fragIt == m_shaderPaths.cend() || vertIt == m_shaderPaths.cend())) { qCWarning(GLTFImporterLog, "program: %ls missing shader: %ls %ls", @@ -1527,27 +1527,27 @@ void GLTFImporter::processJSONProgram(const QString &id, const QJsonObject &json const QString tessCtrlName = jsonObject.value(KEY_TESS_CTRL_SHADER).toString(); if (!tessCtrlName.isEmpty()) { - const auto it = qAsConst(m_shaderPaths).find(tessCtrlName); + const auto it = std::as_const(m_shaderPaths).find(tessCtrlName); prog->setTessellationControlShaderCode( QShaderProgram::loadSource(QUrl::fromLocalFile(it.value()))); } const QString tessEvalName = jsonObject.value(KEY_TESS_EVAL_SHADER).toString(); if (!tessEvalName.isEmpty()) { - const auto it = qAsConst(m_shaderPaths).find(tessEvalName); + const auto it = std::as_const(m_shaderPaths).find(tessEvalName); prog->setTessellationEvaluationShaderCode( QShaderProgram::loadSource(QUrl::fromLocalFile(it.value()))); } const QString geomName = jsonObject.value(KEY_GEOMETRY_SHADER).toString(); if (!geomName.isEmpty()) { - const auto it = qAsConst(m_shaderPaths).find(geomName); + const auto it = std::as_const(m_shaderPaths).find(geomName); prog->setGeometryShaderCode(QShaderProgram::loadSource(QUrl::fromLocalFile(it.value()))); } const QString computeName = jsonObject.value(KEY_COMPUTE_SHADER).toString(); if (!computeName.isEmpty()) { - const auto it = qAsConst(m_shaderPaths).find(computeName); + const auto it = std::as_const(m_shaderPaths).find(computeName); prog->setComputeShaderCode(QShaderProgram::loadSource(QUrl::fromLocalFile(it.value()))); } @@ -1712,7 +1712,7 @@ void GLTFImporter::processJSONMesh(const QString &id, const QJsonObject &json) const QJsonObject attrs = primitiveObject.value(KEY_ATTRIBUTES).toObject(); for (auto it = attrs.begin(), end = attrs.end(); it != end; ++it) { const QString k = (m_majorVersion > 1) ? QString::number(it.value().toInt()) : it.value().toString(); - const auto accessorIt = qAsConst(m_accessorDict).find(k); + const auto accessorIt = std::as_const(m_accessorDict).find(k); if (Q_UNLIKELY(accessorIt == m_accessorDict.cend())) { qCWarning(GLTFImporterLog, "unknown attribute accessor: %ls on mesh %ls", qUtf16PrintableImpl(k), qUtf16PrintableImpl(id)); @@ -1747,7 +1747,7 @@ void GLTFImporter::processJSONMesh(const QString &id, const QJsonObject &json) const auto indices = primitiveObject.value(KEY_INDICES); if (!indices.isUndefined()) { const QString accIndex = (m_majorVersion > 1) ? QString::number(indices.toInt()) : indices.toString(); - const auto accessorIt = qAsConst(m_accessorDict).find(accIndex); + const auto accessorIt = std::as_const(m_accessorDict).find(accIndex); if (Q_UNLIKELY(accessorIt == m_accessorDict.cend())) { qCWarning(GLTFImporterLog, "unknown index accessor: %ls on mesh %ls", qUtf16PrintableImpl(accIndex), qUtf16PrintableImpl(id)); @@ -1889,11 +1889,11 @@ void GLTFImporter::processJSONTexture(const QString &id, const QJsonObject &json QJsonValue srcValue = jsonObject.value(KEY_SOURCE); QString source = (m_majorVersion > 1) ? QString::number(srcValue.toInt()) : srcValue.toString(); - const auto imagIt = qAsConst(m_imagePaths).find(source); + const auto imagIt = std::as_const(m_imagePaths).find(source); if (Q_UNLIKELY(imagIt == m_imagePaths.cend())) { // if an image is not found in paths, it probably means // it was an embedded resource, referenced in m_imageData - const auto embImgIt = qAsConst(m_imageData).find(source); + const auto embImgIt = std::as_const(m_imageData).find(source); if (Q_UNLIKELY(embImgIt == m_imageData.cend())) { qCWarning(GLTFImporterLog, "texture %ls references missing image %ls", qUtf16PrintableImpl(id), qUtf16PrintableImpl(source)); @@ -2035,7 +2035,7 @@ void GLTFImporter::loadBufferData() */ void GLTFImporter::unloadBufferData() { - for (const auto &bufferData : qAsConst(m_bufferDatas)) { + for (const auto &bufferData : std::as_const(m_bufferDatas)) { QByteArray *data = bufferData.data; delete data; } @@ -2497,7 +2497,7 @@ void GLTFImporter::populateRenderStates(QRenderPass *pass, const QJsonObject &st } // Create render states with default values for any remaining enable states - for (int enableState : qAsConst(enableStates)) { + for (int enableState : std::as_const(enableStates)) { QRenderState *renderState = buildStateEnable(enableState); if (renderState != nullptr) pass->addRenderState(renderState); @@ -2506,7 +2506,7 @@ void GLTFImporter::populateRenderStates(QRenderPass *pass, const QJsonObject &st void GLTFImporter::addProgramToPass(QRenderPass *pass, const QString &progName) { - const auto progIt = qAsConst(m_programs).find(progName); + const auto progIt = std::as_const(m_programs).find(progName); if (Q_UNLIKELY(progIt == m_programs.cend())) qCWarning(GLTFImporterLog, "missing program %ls", qUtf16PrintableImpl(progName)); else diff --git a/src/plugins/sceneparsers/gltf/gltfio.cpp b/src/plugins/sceneparsers/gltf/gltfio.cpp index 8f7a516ed..111a8f1f4 100644 --- a/src/plugins/sceneparsers/gltf/gltfio.cpp +++ b/src/plugins/sceneparsers/gltf/gltfio.cpp @@ -213,7 +213,7 @@ Qt3DCore::QEntity* GLTFIO::node(const QString &id) const auto meshes = jsonObj.value(KEY_MESHES).toArray(); for (const QJsonValue &mesh : meshes) { const QString meshName = mesh.toString(); - const auto geometryRenderers = qAsConst(m_meshDict).equal_range(meshName); + const auto geometryRenderers = std::as_const(m_meshDict).equal_range(meshName); if (Q_UNLIKELY(geometryRenderers.first == geometryRenderers.second)) { qCWarning(GLTFIOLog, "node %ls references unknown mesh %ls", qUtf16PrintableImpl(id), qUtf16PrintableImpl(meshName)); @@ -236,11 +236,11 @@ Qt3DCore::QEntity* GLTFIO::node(const QString &id) case 0: break; case 1: - result = qAsConst(entities).first(); + result = std::as_const(entities).first(); break; default: result = new QEntity; - for (QEntity *entity : qAsConst(entities)) + for (QEntity *entity : std::as_const(entities)) entity->setParent(result); } } @@ -508,7 +508,7 @@ QMaterial *GLTFIO::materialWithCustomShader(const QString &id, const QJsonObject { //Default ES2 Technique QString techniqueName = jsonObj.value(KEY_TECHNIQUE).toString(); - const auto it = qAsConst(m_techniques).find(techniqueName); + const auto it = std::as_const(m_techniques).find(techniqueName); if (Q_UNLIKELY(it == m_techniques.cend())) { qCWarning(GLTFIOLog, "unknown technique %ls for material %ls in GLTF file %ls", qUtf16PrintableImpl(techniqueName), qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath)); @@ -526,7 +526,7 @@ QMaterial *GLTFIO::materialWithCustomShader(const QString &id, const QJsonObject QTechnique *gl2Technique = nullptr; QString coreTechniqueName = jsonObj.value(KEY_TECHNIQUE_CORE).toString(); if (!coreTechniqueName.isNull()) { - const auto it = qAsConst(m_techniques).find(coreTechniqueName); + const auto it = std::as_const(m_techniques).find(coreTechniqueName); if (Q_UNLIKELY(it == m_techniques.cend())) { qCWarning(GLTFIOLog, "unknown technique %ls for material %ls in GLTF file %ls", qUtf16PrintableImpl(coreTechniqueName), qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath)); @@ -541,7 +541,7 @@ QMaterial *GLTFIO::materialWithCustomShader(const QString &id, const QJsonObject //Optional GL2 technique QString gl2TechniqueName = jsonObj.value(KEY_TECHNIQUE_GL2).toString(); if (!gl2TechniqueName.isNull()) { - const auto it = qAsConst(m_techniques).find(gl2TechniqueName); + const auto it = std::as_const(m_techniques).find(gl2TechniqueName); if (Q_UNLIKELY(it == m_techniques.cend())) { qCWarning(GLTFIOLog, "unknown technique %ls for material %ls in GLTF file %ls", qUtf16PrintableImpl(gl2TechniqueName), qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath)); @@ -684,7 +684,7 @@ QMaterial *GLTFIO::commonMaterial(const QJsonObject &jsonObj) QMaterial* GLTFIO::material(const QString &id) { - const auto it = qAsConst(m_materialCache).find(id); + const auto it = std::as_const(m_materialCache).find(id); if (it != m_materialCache.cend()) return it.value(); @@ -841,7 +841,7 @@ void GLTFIO::processJSONBuffer(const QString &id, const QJsonObject& json) void GLTFIO::processJSONBufferView(const QString &id, const QJsonObject& json) { QString bufName = json.value(KEY_BUFFER).toString(); - const auto it = qAsConst(m_bufferDatas).find(bufName); + const auto it = std::as_const(m_bufferDatas).find(bufName); if (Q_UNLIKELY(it == m_bufferDatas.cend())) { qCWarning(GLTFIOLog, "unknown buffer: %ls processing view: %ls", qUtf16PrintableImpl(bufName), qUtf16PrintableImpl(id)); @@ -901,8 +901,8 @@ void GLTFIO::processJSONProgram(const QString &id, const QJsonObject &jsonObject { QString fragName = jsonObject.value(KEY_FRAGMENT_SHADER).toString(), vertName = jsonObject.value(KEY_VERTEX_SHADER).toString(); - const auto fragIt = qAsConst(m_shaderPaths).find(fragName), - vertIt = qAsConst(m_shaderPaths).find(vertName); + const auto fragIt = std::as_const(m_shaderPaths).find(fragName), + vertIt = std::as_const(m_shaderPaths).find(vertName); if (Q_UNLIKELY(fragIt == m_shaderPaths.cend() || vertIt == m_shaderPaths.cend())) { qCWarning(GLTFIOLog, "program: %ls missing shader: %ls %ls", qUtf16PrintableImpl(id), qUtf16PrintableImpl(fragName), qUtf16PrintableImpl(vertName)); @@ -948,7 +948,7 @@ void GLTFIO::processJSONTechnique(const QString &id, const QJsonObject &jsonObje // Program QRenderPass* pass = new QRenderPass; QString programName = jsonObject.value(KEY_PROGRAM).toString(); - const auto progIt = qAsConst(m_programs).find(programName); + const auto progIt = std::as_const(m_programs).find(programName); if (Q_UNLIKELY(progIt == m_programs.cend())) { qCWarning(GLTFIOLog, "technique %ls: missing program %ls", qUtf16PrintableImpl(id), qUtf16PrintableImpl(programName)); @@ -1021,7 +1021,7 @@ void GLTFIO::processJSONTechnique(const QString &id, const QJsonObject &jsonObje } //Create render states with default values for any remaining enable states - for (int enableState : qAsConst(enableStates)) { + for (int enableState : std::as_const(enableStates)) { QRenderState *renderState = buildStateEnable(enableState); if (renderState != nullptr) pass->addRenderState(renderState); @@ -1064,7 +1064,7 @@ void GLTFIO::processJSONMesh(const QString &id, const QJsonObject &json) const QJsonObject attrs = primitiveObject.value(KEY_ATTRIBUTES).toObject(); for (auto it = attrs.begin(), end = attrs.end(); it != end; ++it) { QString k = it.value().toString(); - const auto accessorIt = qAsConst(m_accessorDict).find(k); + const auto accessorIt = std::as_const(m_accessorDict).find(k); if (Q_UNLIKELY(accessorIt == m_accessorDict.cend())) { qCWarning(GLTFIOLog, "unknown attribute accessor: %ls on mesh %ls", qUtf16PrintableImpl(k), qUtf16PrintableImpl(id)); @@ -1098,7 +1098,7 @@ void GLTFIO::processJSONMesh(const QString &id, const QJsonObject &json) const auto indices = primitiveObject.value(KEY_INDICES); if (!indices.isUndefined()) { QString k = indices.toString(); - const auto accessorIt = qAsConst(m_accessorDict).find(k); + const auto accessorIt = std::as_const(m_accessorDict).find(k); if (Q_UNLIKELY(accessorIt == m_accessorDict.cend())) { qCWarning(GLTFIOLog, "unknown index accessor: %ls on mesh %ls", qUtf16PrintableImpl(k), qUtf16PrintableImpl(id)); @@ -1155,7 +1155,7 @@ void GLTFIO::processJSONTexture(const QString &id, const QJsonObject &jsonObject QString samplerId = jsonObject.value(KEY_SAMPLER).toString(); QString source = jsonObject.value(KEY_SOURCE).toString(); - const auto imagIt = qAsConst(m_imagePaths).find(source); + const auto imagIt = std::as_const(m_imagePaths).find(source); if (Q_UNLIKELY(imagIt == m_imagePaths.cend())) { qCWarning(GLTFIOLog, "texture %ls references missing image %ls", qUtf16PrintableImpl(id), qUtf16PrintableImpl(source)); @@ -1198,7 +1198,7 @@ void GLTFIO::loadBufferData() void GLTFIO::unloadBufferData() { - for (const auto &bufferData : qAsConst(m_bufferDatas)) { + for (const auto &bufferData : std::as_const(m_bufferDatas)) { QByteArray *data = bufferData.data; delete data; } diff --git a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp index b6843f9e7..67a096141 100644 --- a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp +++ b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp @@ -354,7 +354,7 @@ bool GLTFExporter::exportScene(QEntity *sceneRoot, const QString &outDir, QFile::Permissions targetPermissions = gltfFile.permissions(); // Copy exported scene to actual export directory - for (const auto &sourceFileStr : qAsConst(m_exportedFiles)) { + for (const auto &sourceFileStr : std::as_const(m_exportedFiles)) { QFileInfo fiSource(m_exportDir + sourceFileStr); QFileInfo fiDestination(finalExportDir + sourceFileStr); if (fiDestination.exists()) { @@ -508,7 +508,7 @@ void GLTFExporter::copyTextures() void GLTFExporter::createShaders() { qCDebug(GLTFExporterLog, "Creating shaders..."); - for (const auto &si : qAsConst(m_shaderInfo)) { + for (const auto &si : std::as_const(m_shaderInfo)) { const QString fileName = m_exportDir + si.uri; QFile f(fileName); if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { @@ -932,7 +932,7 @@ void GLTFExporter::parseMeshes() sl << bv.name; qCDebug(GLTFExporterLog) << " buffer views:" << sl; sl.clear(); - for (const auto &acc : qAsConst(meshInfo.accessors)) + for (const auto &acc : std::as_const(meshInfo.accessors)) sl << acc.name; qCDebug(GLTFExporterLog) << " accessors:" << sl; qCDebug(GLTFExporterLog, " material: '%ls'", @@ -1119,7 +1119,7 @@ QString GLTFExporter::addShaderInfo(QShaderProgram::ShaderType type, QByteArray if (code.isEmpty()) return QString(); - for (const auto &si : qAsConst(m_shaderInfo)) { + for (const auto &si : std::as_const(m_shaderInfo)) { if (si.type == QShaderProgram::Vertex && code == si.code) return si.name; } @@ -1184,7 +1184,7 @@ bool GLTFExporter::saveScene() m_obj["buffers"] = buffers; QJsonObject bufferViews; - for (const auto &bv : qAsConst(bvList)) { + for (const auto &bv : std::as_const(bvList)) { QJsonObject bufferView; bufferView["buffer"] = QStringLiteral("buf"); bufferView["byteLength"] = int(bv.length); @@ -1197,7 +1197,7 @@ bool GLTFExporter::saveScene() m_obj["bufferViews"] = bufferViews; QJsonObject accessors; - for (const auto &acc : qAsConst(accList)) { + for (const auto &acc : std::as_const(accList)) { QJsonObject accessor; accessor["bufferView"] = acc.bufferView; accessor["byteOffset"] = int(acc.offset); @@ -1244,7 +1244,7 @@ bool GLTFExporter::saveScene() m_obj["meshes"] = meshes; QJsonObject cameras; - for (const auto &camInfo : qAsConst(m_cameraInfo)) { + for (const auto &camInfo : std::as_const(m_cameraInfo)) { QJsonObject camera; QJsonObject proj; proj["znear"] = camInfo.znear; @@ -1276,7 +1276,7 @@ bool GLTFExporter::saveScene() if (m_rootNodeEmpty) { // Don't export the root node if it is there just to group the scene, so we don't get // an extra empty node when we import the scene back. - for (auto c : qAsConst(m_rootNode->children)) + for (auto c : std::as_const(m_rootNode->children)) sceneNodes << exportNodes(c, nodes); } else { sceneNodes << exportNodes(m_rootNode, nodes); @@ -1484,7 +1484,7 @@ bool GLTFExporter::saveScene() // Save shaders for custom materials QJsonObject shaders; - for (const auto &si : qAsConst(m_shaderInfo)) { + for (const auto &si : std::as_const(m_shaderInfo)) { QJsonObject shaderObj; shaderObj["uri"] = si.uri; shaders[si.name] = shaderObj; @@ -1557,7 +1557,7 @@ bool GLTFExporter::saveScene() QByteArray pre = "<RCC><qresource prefix=\"/gltf_res\">\n"; QByteArray post = "</qresource></RCC>\n"; f.write(pre); - for (const auto &file : qAsConst(m_exportedFiles)) { + for (const auto &file : std::as_const(m_exportedFiles)) { QString line = QString(QStringLiteral(" <file>%1</file>\n")).arg(file); f.write(line.toUtf8()); } @@ -1579,7 +1579,7 @@ void GLTFExporter::delNode(GLTFExporter::Node *n) { if (!n) return; - for (auto *c : qAsConst(n->children)) + for (auto *c : std::as_const(n->children)) delNode(c); delete n; } @@ -1589,7 +1589,7 @@ QString GLTFExporter::exportNodes(GLTFExporter::Node *n, QJsonObject &nodes) QJsonObject node; node["name"] = n->name; QJsonArray children; - for (auto c : qAsConst(n->children)) + for (auto c : std::as_const(n->children)) children << exportNodes(c, nodes); node["children"] = children; if (auto transform = m_transformMap.value(n)) diff --git a/src/quick3d/imports/scene3d/scene3ditem.cpp b/src/quick3d/imports/scene3d/scene3ditem.cpp index b71137552..eb960a8dc 100644 --- a/src/quick3d/imports/scene3d/scene3ditem.cpp +++ b/src/quick3d/imports/scene3d/scene3ditem.cpp @@ -221,7 +221,7 @@ void Scene3DItem::applyAspects() return; // Aspects are owned by the aspect engine - for (const QString &aspect : qAsConst(m_aspects)) { + for (const QString &aspect : std::as_const(m_aspects)) { if (aspect == QLatin1String("render")) // This one is hardwired anyway continue; if (aspect == QLatin1String("input")) { diff --git a/src/quick3d/quick3d/items/quick3dentity.cpp b/src/quick3d/quick3d/items/quick3dentity.cpp index 3a00411e0..d7487b716 100644 --- a/src/quick3d/quick3d/items/quick3dentity.cpp +++ b/src/quick3d/quick3d/items/quick3dentity.cpp @@ -69,7 +69,7 @@ QQmlListProperty<QComponent> Quick3DEntity::componentList() }; auto clearFunction = [](QQmlListProperty<ListContentType> *list) { Quick3DEntity *self = static_cast<Quick3DEntity *>(list->object); - for (QComponent *comp : qAsConst(self->m_managedComponents)) + for (QComponent *comp : std::as_const(self->m_managedComponents)) self->parentEntity()->removeComponent(comp); self->m_managedComponents.clear(); }; diff --git a/src/quick3d/quick3d/items/quick3dgeometry.cpp b/src/quick3d/quick3d/items/quick3dgeometry.cpp index 63cd0d8b9..0a4912df1 100644 --- a/src/quick3d/quick3d/items/quick3dgeometry.cpp +++ b/src/quick3d/quick3d/items/quick3dgeometry.cpp @@ -37,7 +37,7 @@ QQmlListProperty<Qt3DCore::QAttribute> Quick3DGeometry::attributeList() }; auto clearFunction = [](QQmlListProperty<ListContentType> *list) { Quick3DGeometry *geometry = static_cast<Quick3DGeometry *>(list->object); - for (Qt3DCore::QAttribute *attribute : qAsConst(geometry->m_managedAttributes)) + for (Qt3DCore::QAttribute *attribute : std::as_const(geometry->m_managedAttributes)) geometry->parentGeometry()->removeAttribute(attribute); geometry->m_managedAttributes.clear(); }; diff --git a/src/quick3d/quick3dscene2d/items/scene2d.cpp b/src/quick3d/quick3dscene2d/items/scene2d.cpp index 84948d4ff..e679d56af 100644 --- a/src/quick3d/quick3dscene2d/items/scene2d.cpp +++ b/src/quick3d/quick3dscene2d/items/scene2d.cpp @@ -98,7 +98,7 @@ Scene2D::Scene2D() Scene2D::~Scene2D() { - for (auto connection: qAsConst(m_connections)) + for (auto connection: std::as_const(m_connections)) QObject::disconnect(connection); m_connections.clear(); } diff --git a/src/render/backend/attachmentpack.cpp b/src/render/backend/attachmentpack.cpp index b33e94a7b..59a832a66 100644 --- a/src/render/backend/attachmentpack.cpp +++ b/src/render/backend/attachmentpack.cpp @@ -39,7 +39,7 @@ AttachmentPack::AttachmentPack(const RenderTarget *target, // If nothing is specified, use all the attachments as draw buffers if (drawBuffers.empty()) { m_drawBuffers.reserve(m_attachments.size()); - for (const Attachment &attachment : qAsConst(m_attachments)) + for (const Attachment &attachment : std::as_const(m_attachments)) // only consider Color Attachments if (attachment.m_point <= QRenderTargetOutput::Color15) m_drawBuffers.push_back((int) attachment.m_point); diff --git a/src/render/backend/entity.cpp b/src/render/backend/entity.cpp index dba79e269..2b90c4996 100644 --- a/src/render/backend/entity.cpp +++ b/src/render/backend/entity.cpp @@ -85,7 +85,7 @@ void Entity::cleanup() removeFromParentChildHandles(); - for (auto &childHandle : qAsConst(m_childrenHandles)) { + for (auto &childHandle : std::as_const(m_childrenHandles)) { auto child = m_nodeManagers->renderNodesManager()->data(childHandle); // children should always exist and have this as parent // if they were destroyed, they would have removed themselves from our m_childrenHandles @@ -248,7 +248,7 @@ QList<Entity *> Entity::children() const void Entity::traverse(const std::function<void(Entity *)> &operation) { operation(this); - for (const HEntity &handle : qAsConst(m_childrenHandles)) { + for (const HEntity &handle : std::as_const(m_childrenHandles)) { Entity *child = m_nodeManagers->renderNodesManager()->data(handle); if (child != nullptr) child->traverse(operation); diff --git a/src/render/framegraph/rendercapture.cpp b/src/render/framegraph/rendercapture.cpp index 7cb3a5e29..4f92f3221 100644 --- a/src/render/framegraph/rendercapture.cpp +++ b/src/render/framegraph/rendercapture.cpp @@ -76,7 +76,7 @@ void RenderCapture::syncRenderCapturesToFrontend(Qt3DCore::QAspectManager *manag QRenderCapturePrivate *dfrontend = static_cast<QRenderCapturePrivate *>(Qt3DCore::QNodePrivate::get(frontend)); QMutexLocker lock(&m_mutex); - for (const RenderCaptureDataPtr &data : qAsConst(m_renderCaptureData)) { + for (const RenderCaptureDataPtr &data : std::as_const(m_renderCaptureData)) { QPointer<QRenderCaptureReply> reply = dfrontend->takeReply(data.data()->captureId); // Note: QPointer has no operator bool, we must use isNull() to check it if (!reply.isNull()) { diff --git a/src/render/frontend/qrenderaspect.cpp b/src/render/frontend/qrenderaspect.cpp index 759a8f686..9fd4b1bea 100644 --- a/src/render/frontend/qrenderaspect.cpp +++ b/src/render/frontend/qrenderaspect.cpp @@ -475,7 +475,7 @@ void QRenderAspectPrivate::registerBackendTypes() q->registerBackendType<QScreenRayCaster>(QSharedPointer<Render::NodeFunctor<Render::RayCaster, Render::RayCasterManager> >::create(m_renderer)); // Plugins - for (const QString &plugin : qAsConst(m_pluginConfig)) + for (const QString &plugin : std::as_const(m_pluginConfig)) loadRenderPlugin(plugin); } @@ -551,7 +551,7 @@ void QRenderAspectPrivate::unregisterBackendTypes() unregisterBackendType<QScreenRayCaster>(); // Plugins - for (Render::QRenderPlugin *plugin : qAsConst(m_renderPlugins)) + for (Render::QRenderPlugin *plugin : std::as_const(m_renderPlugins)) plugin->unregisterBackendTypes(q); } @@ -964,7 +964,7 @@ void QRenderAspectPrivate::configurePlugin(const QString &plugin) if (!m_pluginConfig.contains(plugin)) { m_pluginConfig.append(plugin); - for (QRenderAspectPrivate *instance : qAsConst(m_instances)) + for (QRenderAspectPrivate *instance : std::as_const(m_instances)) instance->loadRenderPlugin(plugin); } } diff --git a/src/render/geometry/qmesh.cpp b/src/render/geometry/qmesh.cpp index 8b10d64eb..20352d0cf 100644 --- a/src/render/geometry/qmesh.cpp +++ b/src/render/geometry/qmesh.cpp @@ -304,7 +304,7 @@ Qt3DCore::QGeometry *MeshLoaderFunctor::operator()() } QScopedPointer<QGeometryLoaderInterface> loader; - for (const QString &e: qAsConst(ext)) { + for (const QString &e: std::as_const(ext)) { loader.reset(qLoadPlugin<QGeometryLoaderInterface, QGeometryLoaderFactory>(geometryLoader(), e)); if (loader) break; diff --git a/src/render/jobs/filterlayerentityjob.cpp b/src/render/jobs/filterlayerentityjob.cpp index 184cff69a..fd13a4c50 100644 --- a/src/render/jobs/filterlayerentityjob.cpp +++ b/src/render/jobs/filterlayerentityjob.cpp @@ -158,7 +158,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 : std::as_const(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 02b24e957..c2f21bb65 100644 --- a/src/render/jobs/filterproximitydistancejob.cpp +++ b/src/render/jobs/filterproximitydistancejob.cpp @@ -53,7 +53,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 : std::as_const(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/loadscenejob.cpp b/src/render/jobs/loadscenejob.cpp index 1ec5b6833..52b16b041 100644 --- a/src/render/jobs/loadscenejob.cpp +++ b/src/render/jobs/loadscenejob.cpp @@ -121,7 +121,7 @@ Qt3DCore::QEntity *LoadSceneJob::tryLoadScene(QSceneLoader::Status &finalStatus, Qt3DCore::QEntity *sceneSubTree = nullptr; bool foundSuitableLoggerPlugin = false; - for (QSceneImporter *sceneImporter : qAsConst(m_sceneImporters)) { + for (QSceneImporter *sceneImporter : std::as_const(m_sceneImporters)) { if (!sceneImporter->areFileTypesSupported(extensions)) continue; diff --git a/src/render/jobs/materialparametergathererjob.cpp b/src/render/jobs/materialparametergathererjob.cpp index 7dad940a1..b22eab16b 100644 --- a/src/render/jobs/materialparametergathererjob.cpp +++ b/src/render/jobs/materialparametergathererjob.cpp @@ -66,7 +66,7 @@ MaterialParameterGathererJob::MaterialParameterGathererJob() // improvement void MaterialParameterGathererJob::run() { - for (const HMaterial &materialHandle : qAsConst(m_handles)) { + for (const HMaterial &materialHandle : std::as_const(m_handles)) { Material *material = m_manager->materialManager()->data(materialHandle); if (Q_UNLIKELY(!material->isEnabled())) diff --git a/src/render/jobs/pickboundingvolumejob.cpp b/src/render/jobs/pickboundingvolumejob.cpp index 6f1149f0c..6178bdee2 100644 --- a/src/render/jobs/pickboundingvolumejob.cpp +++ b/src/render/jobs/pickboundingvolumejob.cpp @@ -71,7 +71,7 @@ void PickBoundingVolumeJobPrivate::postFrame(Qt3DCore::QAspectManager *manager) QNodeId previousId; QObjectPicker *node = nullptr; - for (auto res: qAsConst(dispatches)) { + for (auto res: std::as_const(dispatches)) { if (previousId != res.pickerId) { node = qobject_cast<QObjectPicker *>(manager->lookupNode(res.pickerId)); previousId = res.pickerId; @@ -355,7 +355,7 @@ void PickBoundingVolumeJob::dispatchPickEvents(const QMouseEvent *event, // How do we differentiate betwnee an Entity with no GeometryRenderer and one with one, both having // an ObjectPicker component when it comes - for (const QCollisionQueryResult::Hit &hit : qAsConst(sphereHits)) { + for (const QCollisionQueryResult::Hit &hit : std::as_const(sphereHits)) { Entity *entity = m_manager->renderNodesManager()->lookupResource(hit.m_entityId); HObjectPicker objectPickerHandle = entity->componentHandle<ObjectPicker>(); @@ -516,7 +516,7 @@ void PickBoundingVolumeJob::clearPreviouslyHoveredPickers() { Q_D(PickBoundingVolumeJob); - for (const HObjectPicker &pickHandle : qAsConst(m_hoveredPickersToClear)) { + for (const HObjectPicker &pickHandle : std::as_const(m_hoveredPickersToClear)) { ObjectPicker *pick = m_manager->objectPickerManager()->data(pickHandle); if (pick) d->dispatches.push_back({pick->peerId(), QEvent::Leave, {}, {}}); diff --git a/src/render/jobs/raycastingjob.cpp b/src/render/jobs/raycastingjob.cpp index 4eb5f2778..5a6fb311a 100644 --- a/src/render/jobs/raycastingjob.cpp +++ b/src/render/jobs/raycastingjob.cpp @@ -75,7 +75,7 @@ bool RayCastingJobPrivate::isRequired() const void RayCastingJobPrivate::postFrame(Qt3DCore::QAspectManager *manager) { - for (auto res: qAsConst(dispatches)) { + for (auto res: std::as_const(dispatches)) { QAbstractRayCaster *node = qobject_cast<QAbstractRayCaster *>(manager->lookupNode(res.first->peerId())); if (!node) continue; @@ -162,7 +162,7 @@ bool RayCastingJob::pick(const QList<QPair<Entity *, RayCaster *>> &entities) Q_UNREACHABLE(); } - for (const QRay3D &ray: qAsConst(rays)) { + for (const QRay3D &ray: std::as_const(rays)) { PickingUtils::HitList sphereHits; PickingUtils::HierarchicalEntityPicker entityPicker(ray, false); entityPicker.setLayerIds(pair.second->layerIds(), pair.second->filterMode()); diff --git a/src/render/jobs/rendersyncjobs_p.h b/src/render/jobs/rendersyncjobs_p.h index b25543d71..5dcf5dd53 100644 --- a/src/render/jobs/rendersyncjobs_p.h +++ b/src/render/jobs/rendersyncjobs_p.h @@ -282,10 +282,10 @@ public: // Reduction { int totalCommandCount = 0; - for (const RenderViewCommandBuilderJobPtrAlias &renderViewCommandBuilder : qAsConst(m_renderViewCommandBuilderJobs)) + for (const RenderViewCommandBuilderJobPtrAlias &renderViewCommandBuilder : std::as_const(m_renderViewCommandBuilderJobs)) totalCommandCount += int(renderViewCommandBuilder->commandData().size()); commandData.reserve(totalCommandCount); - for (const RenderViewCommandBuilderJobPtrAlias &renderViewCommandBuilder : qAsConst(m_renderViewCommandBuilderJobs)) + for (const RenderViewCommandBuilderJobPtrAlias &renderViewCommandBuilder : std::as_const(m_renderViewCommandBuilderJobs)) commandData += std::move(renderViewCommandBuilder->commandData()); } diff --git a/src/render/jobs/sendbuffercapturejob.cpp b/src/render/jobs/sendbuffercapturejob.cpp index 47381df60..1e92ee212 100644 --- a/src/render/jobs/sendbuffercapturejob.cpp +++ b/src/render/jobs/sendbuffercapturejob.cpp @@ -62,7 +62,7 @@ void SendBufferCaptureJob::run() Q_ASSERT(m_nodeManagers); Q_D(SendBufferCaptureJob); QMutexLocker locker(&d->m_mutex); - for (const QPair<Qt3DCore::QNodeId, QByteArray> &pendingCapture : qAsConst(d->m_buffersToCapture)) { + for (const QPair<Qt3DCore::QNodeId, QByteArray> &pendingCapture : std::as_const(d->m_buffersToCapture)) { Buffer *buffer = m_nodeManagers->bufferManager()->lookupResource(pendingCapture.first); // Buffer might have been destroyed between the time addRequest is made and this job gets run // If it exists however, it cannot be destroyed before this job is done running diff --git a/src/render/jobs/updatelevelofdetailjob.cpp b/src/render/jobs/updatelevelofdetailjob.cpp index 6c6c683e8..c7ca231a4 100644 --- a/src/render/jobs/updatelevelofdetailjob.cpp +++ b/src/render/jobs/updatelevelofdetailjob.cpp @@ -238,7 +238,7 @@ bool UpdateLevelOfDetailJobPrivate::isRequired() const void UpdateLevelOfDetailJobPrivate::postFrame(Qt3DCore::QAspectManager *manager) { - for (const auto &updatedNode: qAsConst(m_updatedIndices)) { + for (const auto &updatedNode: std::as_const(m_updatedIndices)) { QLevelOfDetail *node = qobject_cast<QLevelOfDetail *>(manager->lookupNode(updatedNode.first)); if (!node) continue; diff --git a/src/render/jobs/updateskinningpalettejob.cpp b/src/render/jobs/updateskinningpalettejob.cpp index a61038628..1fd571144 100644 --- a/src/render/jobs/updateskinningpalettejob.cpp +++ b/src/render/jobs/updateskinningpalettejob.cpp @@ -35,7 +35,7 @@ void UpdateSkinningPaletteJob::run() // Update the local pose transforms of JointInfo's in Skeletons from // the set of dirty joints. - for (const auto &jointHandle : qAsConst(m_dirtyJoints)) { + for (const auto &jointHandle : std::as_const(m_dirtyJoints)) { Joint *joint = m_nodeManagers->jointManager()->data(jointHandle); Q_ASSERT(joint); Skeleton *skeleton = m_nodeManagers->skeletonManager()->data(joint->owningSkeleton()); @@ -54,7 +54,7 @@ void UpdateSkinningPaletteJob::run() // Update the skeleton for each dirty armature auto skeletonManager = m_nodeManagers->skeletonManager(); - for (const auto &armatureHandle : qAsConst(dirtyArmatures)) { + for (const auto &armatureHandle : std::as_const(dirtyArmatures)) { auto armature = armatureManager->data(armatureHandle); Q_ASSERT(armature); diff --git a/src/render/materialsystem/technique.cpp b/src/render/materialsystem/technique.cpp index 4237d414c..ef691bab0 100644 --- a/src/render/materialsystem/technique.cpp +++ b/src/render/materialsystem/technique.cpp @@ -145,7 +145,7 @@ bool Technique::isCompatibleWithFilters(const QNodeIdVector &filterKeyIds) bool foundMatch = false; - for (const QNodeId &techniqueFilterKeyId : qAsConst(m_filterKeyList)) { + for (const QNodeId &techniqueFilterKeyId : std::as_const(m_filterKeyList)) { FilterKey *techniqueFilterKey = m_nodeManager->filterKeyManager()->lookupResource(techniqueFilterKeyId); if ((foundMatch = (*techniqueFilterKey == *filterKey))) break; diff --git a/src/render/raycasting/qraycastingservice.cpp b/src/render/raycasting/qraycastingservice.cpp index 6e7d10d29..28d0aec21 100644 --- a/src/render/raycasting/qraycastingservice.cpp +++ b/src/render/raycasting/qraycastingservice.cpp @@ -114,7 +114,7 @@ QCollisionQueryResult QRayCastingServicePrivate::collides(const QRay3D &ray, QBo hits = reduceToAllHits(hits, gathererFunctor(volume)); #endif std::sort(hits.begin(), hits.end(), compareHitsDistance); - for (const Hit &hit : qAsConst(hits)) + for (const Hit &hit : std::as_const(hits)) q->addEntityHit(result, hit.id, hit.intersection, hit.distance, hit.uvw); } diff --git a/src/render/renderstates/renderstateset.cpp b/src/render/renderstates/renderstateset.cpp index ab6fbdbc3..3eb7c2d33 100644 --- a/src/render/renderstates/renderstateset.cpp +++ b/src/render/renderstates/renderstateset.cpp @@ -45,7 +45,7 @@ int RenderStateSet::changeCost(RenderStateSet *previousState) cost += int(bs.count()); // now, find out how many states we're changing - for (const StateVariant &ds : qAsConst(m_states)) { + for (const StateVariant &ds : std::as_const(m_states)) { // if the other state contains matching, then doesn't // contribute to cost at all if (previousState->contains(ds)) diff --git a/src/render/shadergraph/qshadergenerator.cpp b/src/render/shadergraph/qshadergenerator.cpp index 393d06222..05e578c78 100644 --- a/src/render/shadergraph/qshadergenerator.cpp +++ b/src/render/shadergraph/qshadergenerator.cpp @@ -498,7 +498,7 @@ QByteArray QShaderGenerator::createShaderCode(const QStringList &enabledLayers) qCDebug(ShaderGenerator) << "Begin Substituting " << v->name << " = " << v->assignment.expression; - for (Variable *ref : qAsConst(v->assignment.referencedVariables)) { + for (Variable *ref : std::as_const(v->assignment.referencedVariables)) { // Recursively substitute Variable::substitute(ref); @@ -751,7 +751,7 @@ QByteArray QShaderGenerator::createShaderCode(const QStringList &enabledLayers) } // Go throug all lines and insert content - for (const LineContent &lineContent : qAsConst(lines)) { + for (const LineContent &lineContent : std::as_const(lines)) { if (!lineContent.rawContent.isEmpty()) { code << lineContent.rawContent; } diff --git a/src/render/shadergraph/qshadernode.cpp b/src/render/shadergraph/qshadernode.cpp index 105dd9a9f..b86bfdef3 100644 --- a/src/render/shadergraph/qshadernode.cpp +++ b/src/render/shadergraph/qshadernode.cpp @@ -11,7 +11,7 @@ QShaderNode::Type QShaderNode::type() const noexcept { int inputCount = 0; int outputCount = 0; - for (const auto &port : qAsConst(m_ports)) { + for (const auto &port : std::as_const(m_ports)) { switch (port.direction) { case QShaderNodePort::Input: inputCount++; diff --git a/src/render/texture/qtexture.cpp b/src/render/texture/qtexture.cpp index f00a0c23c..0efa7c805 100644 --- a/src/render/texture/qtexture.cpp +++ b/src/render/texture/qtexture.cpp @@ -1050,7 +1050,7 @@ QTextureDataPtr QTextureFromSourceGenerator::operator ()() ext << mtype.suffixes(); } - for (const QString &s: qAsConst(ext)) { + for (const QString &s: std::as_const(ext)) { textureData = TextureLoadingHelper::loadTextureData(&buffer, s, true, m_mirrored); if (textureData && textureData->data().size() > 0) break; diff --git a/tests/auto/core/qscene/tst_qscene.cpp b/tests/auto/core/qscene/tst_qscene.cpp index 1dc512205..ce20eb364 100644 --- a/tests/auto/core/qscene/tst_qscene.cpp +++ b/tests/auto/core/qscene/tst_qscene.cpp @@ -59,7 +59,7 @@ void tst_QScene::addNodeObservable() scene->addObservable(nodes.at(i)); // THEN - for (Qt3DCore::QNode *n : qAsConst(nodes)) { + for (Qt3DCore::QNode *n : std::as_const(nodes)) { QVERIFY(n == scene->lookupNode(n->id())); } } @@ -112,7 +112,7 @@ void tst_QScene::addChildNode() QCoreApplication::processEvents(); // THEN - for (Qt3DCore::QNode *n : qAsConst(nodes)) { + for (Qt3DCore::QNode *n : std::as_const(nodes)) { QVERIFY(scene->lookupNode(n->id()) == n); } } @@ -153,16 +153,16 @@ void tst_QScene::deleteChildNode() QCoreApplication::processEvents(); // THEN - for (Qt3DCore::QNode *n : qAsConst(nodes1)) { + for (Qt3DCore::QNode *n : std::as_const(nodes1)) { QVERIFY(scene->lookupNode(n->id()) == n); } - for (Qt3DCore::QNode *n : qAsConst(nodes2)) { + for (Qt3DCore::QNode *n : std::as_const(nodes2)) { QVERIFY(scene->lookupNode(n->id()) == n); } // gather node IDs Qt3DCore::QNodeIdVector root1ChildIds; - for (Qt3DCore::QNode *n : qAsConst(nodes1)) + for (Qt3DCore::QNode *n : std::as_const(nodes1)) root1ChildIds << n->id(); // WHEN @@ -170,7 +170,7 @@ void tst_QScene::deleteChildNode() QCoreApplication::processEvents(); // THEN - for (Qt3DCore::QNodeId id : qAsConst(root1ChildIds)) { + for (Qt3DCore::QNodeId id : std::as_const(root1ChildIds)) { QVERIFY(scene->lookupNode(id) == nullptr); } @@ -179,7 +179,7 @@ void tst_QScene::deleteChildNode() QCoreApplication::processEvents(); // THEN - for (Qt3DCore::QNode *n : qAsConst(nodes2)) { + for (Qt3DCore::QNode *n : std::as_const(nodes2)) { QVERIFY(scene->lookupNode(n->id()) == nullptr); } } diff --git a/tests/auto/render/raycasting/tst_raycasting.cpp b/tests/auto/render/raycasting/tst_raycasting.cpp index ad8c3af79..88a5ca030 100644 --- a/tests/auto/render/raycasting/tst_raycasting.cpp +++ b/tests/auto/render/raycasting/tst_raycasting.cpp @@ -161,7 +161,7 @@ void tst_RayCasting::shouldReturnAllResults() // THEN bool expectedHandlesFound = true; - for (QQueryHandle expected : qAsConst(handles)) { + for (QQueryHandle expected : std::as_const(handles)) { bool found = false; for (QCollisionQueryResult result : results) { if (result.handle() == expected) diff --git a/tests/auto/render/raycastingjob/tst_raycastingjob.cpp b/tests/auto/render/raycastingjob/tst_raycastingjob.cpp index 8bf581271..db41614a9 100644 --- a/tests/auto/render/raycastingjob/tst_raycastingjob.cpp +++ b/tests/auto/render/raycastingjob/tst_raycastingjob.cpp @@ -262,7 +262,7 @@ private Q_SLOTS: Qt3DCore::QComponentVector rootComponents = root->components(); Qt3DRender::QRayCaster *rayCaster = nullptr; - for (Qt3DCore::QComponent *c: qAsConst(rootComponents)) { + for (Qt3DCore::QComponent *c: std::as_const(rootComponents)) { rayCaster = qobject_cast<Qt3DRender::QRayCaster *>(c); if (rayCaster) break; @@ -325,7 +325,7 @@ private Q_SLOTS: Qt3DCore::QComponentVector rootComponents = root->components(); Qt3DRender::QScreenRayCaster *rayCaster = nullptr; - for (Qt3DCore::QComponent *c: qAsConst(rootComponents)) { + for (Qt3DCore::QComponent *c: std::as_const(rootComponents)) { rayCaster = qobject_cast<Qt3DRender::QScreenRayCaster *>(c); if (rayCaster) break; diff --git a/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp b/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp index d0140e7bf..661bfb738 100644 --- a/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp +++ b/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp @@ -116,7 +116,7 @@ struct NodeCollection // THEN QCOMPARE(aspect->nodeManagers()->shaderDataManager()->activeHandles().size(), size_t(shaderData.size())); - for (const Qt3DRender::QShaderData *s : qAsConst(shaderData)) { + for (const Qt3DRender::QShaderData *s : std::as_const(shaderData)) { Qt3DRender::Render::ShaderData *backend = aspect->nodeManagers()->shaderDataManager()->lookupResource(s->id()); QVERIFY(backend != nullptr); backendShaderData.push_back(backend); diff --git a/tests/benchmarks/core/qresourcesmanager/arraypolicy/tst_bench_arraypolicy.cpp b/tests/benchmarks/core/qresourcesmanager/arraypolicy/tst_bench_arraypolicy.cpp index b5a1f8292..36f29ae21 100644 --- a/tests/benchmarks/core/qresourcesmanager/arraypolicy/tst_bench_arraypolicy.cpp +++ b/tests/benchmarks/core/qresourcesmanager/arraypolicy/tst_bench_arraypolicy.cpp @@ -50,7 +50,7 @@ void benchmarkReleaseResources() } QBENCHMARK_ONCE { - for (auto ptr : qAsConst(resources)) { + for (auto ptr : std::as_const(resources)) { allocator.releaseResource(ptr); } } diff --git a/tests/benchmarks/render/opengl/shaderparameterpack/tst_bench_shaderparameterpack.cpp b/tests/benchmarks/render/opengl/shaderparameterpack/tst_bench_shaderparameterpack.cpp index 1a910c4ed..2c626f7f2 100644 --- a/tests/benchmarks/render/opengl/shaderparameterpack/tst_bench_shaderparameterpack.cpp +++ b/tests/benchmarks/render/opengl/shaderparameterpack/tst_bench_shaderparameterpack.cpp @@ -29,7 +29,7 @@ private Q_SLOTS: randKeys[i] = gen.generate(); QBENCHMARK { - for (const int key : qAsConst(randKeys)) + for (const int key : std::as_const(randKeys)) pack.insert(key, UniformValue(key)); } } diff --git a/tests/manual/deferred-renderer-cpp/deferredrenderer.cpp b/tests/manual/deferred-renderer-cpp/deferredrenderer.cpp index 965cb1ad4..bc6dac23d 100644 --- a/tests/manual/deferred-renderer-cpp/deferredrenderer.cpp +++ b/tests/manual/deferred-renderer-cpp/deferredrenderer.cpp @@ -38,13 +38,13 @@ void DeferredRenderer::setSceneCamera(Qt3DCore::QEntity *camera) void DeferredRenderer::setGeometryPassCriteria(QList<Qt3DRender::QFilterKey *> criteria) { - for (Qt3DRender::QFilterKey *c : qAsConst(criteria)) + for (Qt3DRender::QFilterKey *c : std::as_const(criteria)) m_geometryPassFilter->addMatch(c); } void DeferredRenderer::setFinalPassCriteria(QList<Qt3DRender::QFilterKey *> criteria) { - for (Qt3DRender::QFilterKey *c : qAsConst(criteria)) + for (Qt3DRender::QFilterKey *c : std::as_const(criteria)) c->setParent(m_finalPassFilter); } |