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-18 23:52:04 +0100 |
commit | 4979e677ebc2c85e09bc67939081f70cf78484d2 (patch) | |
tree | 354ce5a4fe65890263de45a55cce245dafeefc09 | |
parent | 7a501ec6c82c8f8d5997b5d30e667d7820faed1c (diff) |
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>
170 files changed, 443 insertions, 443 deletions
diff --git a/src/labs/platform/qquicklabsplatformmenu.cpp b/src/labs/platform/qquicklabsplatformmenu.cpp index aad1ac8a68..cd23813d63 100644 --- a/src/labs/platform/qquicklabsplatformmenu.cpp +++ b/src/labs/platform/qquicklabsplatformmenu.cpp @@ -194,7 +194,7 @@ QQuickLabsPlatformMenu::~QQuickLabsPlatformMenu() void QQuickLabsPlatformMenu::unparentSubmenus() { - for (QQuickLabsPlatformMenuItem *item : qAsConst(m_items)) { + for (QQuickLabsPlatformMenuItem *item : std::as_const(m_items)) { if (QQuickLabsPlatformMenu *subMenu = item->subMenu()) subMenu->setParentMenu(nullptr); item->setMenu(nullptr); @@ -234,7 +234,7 @@ QPlatformMenu * QQuickLabsPlatformMenu::create() connect(m_handle, &QPlatformMenu::aboutToShow, this, &QQuickLabsPlatformMenu::aboutToShow); connect(m_handle, &QPlatformMenu::aboutToHide, this, &QQuickLabsPlatformMenu::aboutToHide); - for (QQuickLabsPlatformMenuItem *item : qAsConst(m_items)) + for (QQuickLabsPlatformMenuItem *item : std::as_const(m_items)) m_handle->insertMenuItem(item->create(), nullptr); if (m_menuItem) { @@ -278,7 +278,7 @@ void QQuickLabsPlatformMenu::sync() m_systemTrayIcon->handle()->updateMenu(m_handle); #endif - for (QQuickLabsPlatformMenuItem *item : qAsConst(m_items)) + for (QQuickLabsPlatformMenuItem *item : std::as_const(m_items)) item->sync(); } @@ -654,7 +654,7 @@ void QQuickLabsPlatformMenu::clear() if (m_items.isEmpty()) return; - for (QQuickLabsPlatformMenuItem *item : qAsConst(m_items)) { + for (QQuickLabsPlatformMenuItem *item : std::as_const(m_items)) { m_data.removeOne(item); if (m_handle) m_handle->removeMenuItem(item->handle()); diff --git a/src/labs/platform/qquicklabsplatformmenubar.cpp b/src/labs/platform/qquicklabsplatformmenubar.cpp index d6349d5c11..8c0b4fd042 100644 --- a/src/labs/platform/qquicklabsplatformmenubar.cpp +++ b/src/labs/platform/qquicklabsplatformmenubar.cpp @@ -85,7 +85,7 @@ QQuickLabsPlatformMenuBar::QQuickLabsPlatformMenuBar(QObject *parent) QQuickLabsPlatformMenuBar::~QQuickLabsPlatformMenuBar() { - for (QQuickLabsPlatformMenu *menu : qAsConst(m_menus)) + for (QQuickLabsPlatformMenu *menu : std::as_const(m_menus)) menu->setMenuBar(nullptr); delete m_handle; m_handle = nullptr; @@ -204,7 +204,7 @@ void QQuickLabsPlatformMenuBar::clear() if (m_menus.isEmpty()) return; - for (QQuickLabsPlatformMenu *menu : qAsConst(m_menus)) { + for (QQuickLabsPlatformMenu *menu : std::as_const(m_menus)) { m_data.removeOne(menu); if (m_handle) m_handle->removeMenu(menu->handle()); @@ -223,7 +223,7 @@ void QQuickLabsPlatformMenuBar::classBegin() void QQuickLabsPlatformMenuBar::componentComplete() { m_complete = true; - for (QQuickLabsPlatformMenu *menu : qAsConst(m_menus)) + for (QQuickLabsPlatformMenu *menu : std::as_const(m_menus)) menu->sync(); if (!m_window) setWindow(findWindow()); diff --git a/src/labs/platform/qquicklabsplatformmenuitemgroup.cpp b/src/labs/platform/qquicklabsplatformmenuitemgroup.cpp index d3d183ec0f..33580dd04e 100644 --- a/src/labs/platform/qquicklabsplatformmenuitemgroup.cpp +++ b/src/labs/platform/qquicklabsplatformmenuitemgroup.cpp @@ -131,7 +131,7 @@ void QQuickLabsPlatformMenuItemGroup::setEnabled(bool enabled) m_enabled = enabled; emit enabledChanged(); - for (QQuickLabsPlatformMenuItem *item : qAsConst(m_items)) { + for (QQuickLabsPlatformMenuItem *item : std::as_const(m_items)) { if (item->m_enabled) { item->sync(); emit item->enabledChanged(); @@ -160,7 +160,7 @@ void QQuickLabsPlatformMenuItemGroup::setVisible(bool visible) m_visible = visible; emit visibleChanged(); - for (QQuickLabsPlatformMenuItem *item : qAsConst(m_items)) { + for (QQuickLabsPlatformMenuItem *item : std::as_const(m_items)) { if (item->m_visible) { item->sync(); emit item->visibleChanged(); @@ -189,7 +189,7 @@ void QQuickLabsPlatformMenuItemGroup::setExclusive(bool exclusive) m_exclusive = exclusive; emit exclusiveChanged(); - for (QQuickLabsPlatformMenuItem *item : qAsConst(m_items)) + for (QQuickLabsPlatformMenuItem *item : std::as_const(m_items)) item->sync(); } @@ -284,7 +284,7 @@ void QQuickLabsPlatformMenuItemGroup::clear() if (m_items.isEmpty()) return; - for (QQuickLabsPlatformMenuItem *item : qAsConst(m_items)) { + for (QQuickLabsPlatformMenuItem *item : std::as_const(m_items)) { item->setGroup(nullptr); disconnect(item, &QQuickLabsPlatformMenuItem::checkedChanged, this, &QQuickLabsPlatformMenuItemGroup::updateCurrent); disconnect(item, &QQuickLabsPlatformMenuItem::triggered, this, &QQuickLabsPlatformMenuItemGroup::activateItem); diff --git a/src/particles/qquickcustomaffector.cpp b/src/particles/qquickcustomaffector.cpp index 92b52065bb..71ada8a5b9 100644 --- a/src/particles/qquickcustomaffector.cpp +++ b/src/particles/qquickcustomaffector.cpp @@ -84,7 +84,7 @@ void QQuickCustomAffector::affectSystem(qreal dt) updateOffsets(); QList<QQuickParticleData*> toAffect; - for (const QQuickParticleGroupData *gd : qAsConst(m_system->groupData)) { + for (const QQuickParticleGroupData *gd : std::as_const(m_system->groupData)) { if (activeGroup(gd->index)) { for (QQuickParticleData *d : gd->data) { if (shouldAffect(d)) { @@ -98,7 +98,7 @@ void QQuickCustomAffector::affectSystem(qreal dt) return; if (justAffected) { - for (const QQuickParticleData *d : qAsConst(toAffect)) {//Not postAffect to avoid saying the particle changed + for (const QQuickParticleData *d : std::as_const(toAffect)) {//Not postAffect to avoid saying the particle changed if (m_onceOff) m_onceOffed << qMakePair(d->groupId, d->index); emit affected(d->curX(m_system), d->curY(m_system)); @@ -140,7 +140,7 @@ void QQuickCustomAffector::affectSystem(qreal dt) doAffect(dt); } - for (QQuickParticleData *d : qAsConst(toAffect)) + for (QQuickParticleData *d : std::as_const(toAffect)) if (d->update == 1.0) postAffect(d); } diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp index 90ece1fc7a..9730fd1960 100644 --- a/src/particles/qquickimageparticle.cpp +++ b/src/particles/qquickimageparticle.cpp @@ -981,7 +981,7 @@ void QQuickImageParticle::resetColor() { m_explicitColor = false; for (auto groupId : groupIds()) { - for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) { + for (QQuickParticleData* d : std::as_const(m_system->groupData[groupId]->data)) { if (d->colorOwner == this) { d->colorOwner = nullptr; } @@ -1000,7 +1000,7 @@ void QQuickImageParticle::resetRotation() { m_explicitRotation = false; for (auto groupId : groupIds()) { - for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) { + for (QQuickParticleData* d : std::as_const(m_system->groupData[groupId]->data)) { if (d->rotationOwner == this) { d->rotationOwner = nullptr; } @@ -1017,7 +1017,7 @@ void QQuickImageParticle::resetDeformation() { m_explicitDeformation = false; for (auto groupId : groupIds()) { - for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) { + for (QQuickParticleData* d : std::as_const(m_system->groupData[groupId]->data)) { if (d->deformationOwner == this) { d->deformationOwner = nullptr; } @@ -1261,7 +1261,7 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node) for (auto groupId : groupIds()) { //For sharing higher levels, need to have highest used so it renders - for (QQuickParticlePainter* p : qAsConst(m_system->groupData[groupId]->painters)) { + for (QQuickParticlePainter* p : std::as_const(m_system->groupData[groupId]->painters)) { QQuickImageParticle* other = qobject_cast<QQuickImageParticle*>(p); if (other){ if (other->perfLevel > perfLevel) { @@ -1616,7 +1616,7 @@ void QQuickImageParticle::spritesUpdate(qreal time) ImageMaterialData *state = getState(m_material); // Sprite progression handled CPU side, so as to have per-frame control. for (auto groupId : groupIds()) { - for (QQuickParticleData* mainDatum : qAsConst(m_system->groupData[groupId]->data)) { + for (QQuickParticleData* mainDatum : std::as_const(m_system->groupData[groupId]->data)) { QSGGeometryNode *node = m_nodes[groupId]; if (!node) continue; diff --git a/src/particles/qquickitemparticle.cpp b/src/particles/qquickitemparticle.cpp index dd8d989378..cd48095b18 100644 --- a/src/particles/qquickitemparticle.cpp +++ b/src/particles/qquickitemparticle.cpp @@ -125,7 +125,7 @@ void QQuickItemParticle::take(QQuickItem *item, bool prioritize) void QQuickItemParticle::give(QQuickItem *item) { for (auto groupId : groupIds()) { - for (QQuickParticleData* data : qAsConst(m_system->groupData[groupId]->data)) { + for (QQuickParticleData* data : std::as_const(m_system->groupData[groupId]->data)) { if (data->delegate == item){ m_deletables << item; data->delegate = nullptr; @@ -173,7 +173,7 @@ void QQuickItemParticle::tick(int time) Q_UNUSED(time);//only needed because QTickAnimationProxy expects one processDeletables(); for (auto groupId : groupIds()) { - for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) { + for (QQuickParticleData* d : std::as_const(m_system->groupData[groupId]->data)) { if (!d->delegate && d->t != -1 && d->stillAlive(m_system)) { QQuickItem* parentItem = nullptr; if (!m_pendingItems.isEmpty()){ @@ -214,7 +214,7 @@ void QQuickItemParticle::reset() // but leave it alone if the logical particle is maintained QSet<QQuickItem*> lost = QSet<QQuickItem*>(m_managed.cbegin(), m_managed.cend()); for (auto groupId : groupIds()) { - for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) { + for (QQuickParticleData* d : std::as_const(m_system->groupData[groupId]->data)) { lost.remove(d->delegate); } } @@ -251,7 +251,7 @@ void QQuickItemParticle::prepareNextFrame() //TODO: Size, better fade? for (auto groupId : groupIds()) { - for (QQuickParticleData* data : qAsConst(m_system->groupData[groupId]->data)) { + for (QQuickParticleData* data : std::as_const(m_system->groupData[groupId]->data)) { QQuickItem* item = data->delegate; if (!item) continue; diff --git a/src/particles/qquickparticleaffector.cpp b/src/particles/qquickparticleaffector.cpp index d3594a7bac..17038f4593 100644 --- a/src/particles/qquickparticleaffector.cpp +++ b/src/particles/qquickparticleaffector.cpp @@ -177,9 +177,9 @@ void QQuickParticleAffector::affectSystem(qreal dt) updateOffsets();//### Needed if an ancestor is transformed. if (m_onceOff) dt = 1.0; - for (QQuickParticleGroupData* gd : qAsConst(m_system->groupData)) { + for (QQuickParticleGroupData* gd : std::as_const(m_system->groupData)) { if (activeGroup(gd->index)) { - for (QQuickParticleData* d : qAsConst(gd->data)) { + for (QQuickParticleData* d : std::as_const(gd->data)) { if (shouldAffect(d)) { bool affected = false; qreal myDt = dt; diff --git a/src/particles/qquickparticlesystem.cpp b/src/particles/qquickparticlesystem.cpp index 35115183a5..655cd4a78e 100644 --- a/src/particles/qquickparticlesystem.cpp +++ b/src/particles/qquickparticlesystem.cpp @@ -288,7 +288,7 @@ QQuickParticleGroupData::QQuickParticleGroupData(const QString &name, QQuickPart QQuickParticleGroupData::~QQuickParticleGroupData() { - for (QQuickParticleData *d : qAsConst(data)) + for (QQuickParticleData *d : std::as_const(data)) delete d; } @@ -311,7 +311,7 @@ void QQuickParticleGroupData::setSize(int newSize) } int delta = newSize - m_size; m_size = newSize; - for (QQuickParticlePainter *p : qAsConst(painters)) + for (QQuickParticlePainter *p : std::as_const(painters)) p->setCount(p->count() + delta); } @@ -324,7 +324,7 @@ void QQuickParticleGroupData::kill(QQuickParticleData* d) { Q_ASSERT(d->groupId == index); d->lifeSpan = 0;//Kill off - for (QQuickParticlePainter *p : qAsConst(painters)) + for (QQuickParticlePainter *p : std::as_const(painters)) p->reload(d); freeList.free(d->index); } @@ -543,7 +543,7 @@ QQuickParticleSystem::QQuickParticleSystem(QQuickItem *parent) : QQuickParticleSystem::~QQuickParticleSystem() { - for (QQuickParticleGroupData *gd : qAsConst(groupData)) + for (QQuickParticleGroupData *gd : std::as_const(groupData)) delete gd; } @@ -557,10 +557,10 @@ void QQuickParticleSystem::initGroups() groupIds.clear(); nextFreeGroupId = 0; - for (auto e : qAsConst(m_emitters)) { + for (auto e : std::as_const(m_emitters)) { e->reclaculateGroupId(); } - for (QQuickParticlePainter *p : qAsConst(m_painters)) { + for (QQuickParticlePainter *p : std::as_const(m_painters)) { p->recalculateGroupIds(); } @@ -632,7 +632,7 @@ void QQuickParticleSystem::setPaused(bool arg) { if (m_animation && m_animation->state() != QAbstractAnimation::Stopped) m_paused ? m_animation->pause() : m_animation->resume(); if (!m_paused) { - for (QQuickParticlePainter *p : qAsConst(m_painters)) { + for (QQuickParticlePainter *p : std::as_const(m_painters)) { if (p) { p->update(); } @@ -741,12 +741,12 @@ void QQuickParticleSystem::reset() if (!m_running) return; - for (QQuickParticleEmitter *e : qAsConst(m_emitters)) + for (QQuickParticleEmitter *e : std::as_const(m_emitters)) e->reset(); emittersChanged(); - for (QQuickParticlePainter *p : qAsConst(m_painters)) { + for (QQuickParticlePainter *p : std::as_const(m_painters)) { loadPainter(p); p->reset(); } @@ -839,13 +839,13 @@ void QQuickParticleSystem::emittersChanged() if (particleCount > bySysIdx.size())//New datum requests haven't updated it bySysIdx.resize(particleCount); - for (QQuickParticleAffector *a : qAsConst(m_affectors)) {//Groups may have changed + for (QQuickParticleAffector *a : std::as_const(m_affectors)) {//Groups may have changed if (a) { a->m_updateIntSet = true; } } - for (QQuickParticlePainter *p : qAsConst(m_painters)) + for (QQuickParticlePainter *p : std::as_const(m_painters)) loadPainter(p); if (!m_groups.isEmpty()) @@ -860,7 +860,7 @@ void QQuickParticleSystem::createEngine() if (stateEngine && m_debugMode) qDebug() << "Resetting Existing Sprite Engine..."; //### Solve the losses if size/states go down - for (QQuickParticleGroup *group : qAsConst(m_groups)) { + for (QQuickParticleGroup *group : std::as_const(m_groups)) { bool exists = false; for (auto it = groupIds.keyBegin(), end = groupIds.keyEnd(); it != end; ++it) { if (group->name() == *it) { @@ -880,7 +880,7 @@ void QQuickParticleSystem::createEngine() for (int i = 0, ei = groupData.size(); i != ei; ++i) { bool exists = false; QString name = groupData[i]->name(); - for (QQuickParticleGroup *existing : qAsConst(m_groups)) { + for (QQuickParticleGroup *existing : std::as_const(m_groups)) { if (existing->name() == name) { newList << existing; exists = true; @@ -894,7 +894,7 @@ void QQuickParticleSystem::createEngine() m_groups = newList; QList<QQuickStochasticState*> states; states.reserve(m_groups.size()); - for (QQuickParticleGroup *g : qAsConst(m_groups)) + for (QQuickParticleGroup *g : std::as_const(m_groups)) states << (QQuickStochasticState*)g; if (!stateEngine) @@ -999,10 +999,10 @@ void QQuickParticleSystem::finishNewDatum(QQuickParticleData *pd) Q_ASSERT(pd); groupData[pd->groupId]->prepareRecycler(pd); - for (QQuickParticleAffector *a : qAsConst(m_affectors)) + for (QQuickParticleAffector *a : std::as_const(m_affectors)) if (a && a->m_needsReset) a->reset(pd); - for (QQuickParticlePainter *p : qAsConst(groupData[pd->groupId]->painters)) + for (QQuickParticlePainter *p : std::as_const(groupData[pd->groupId]->painters)) if (p) p->load(pd); } @@ -1025,18 +1025,18 @@ void QQuickParticleSystem::updateCurrentTime( int currentTime ) bool oldClear = m_empty; m_empty = true; - for (QQuickParticleGroupData *gd : qAsConst(groupData))//Recycle all groups and see if they're out of live particles + for (QQuickParticleGroupData *gd : std::as_const(groupData))//Recycle all groups and see if they're out of live particles m_empty = gd->recycle() && m_empty; if (stateEngine) stateEngine->updateSprites(timeInt); - for (QQuickParticleEmitter *emitter : qAsConst(m_emitters)) + for (QQuickParticleEmitter *emitter : std::as_const(m_emitters)) emitter->emitWindow(timeInt); - for (QQuickParticleAffector *a : qAsConst(m_affectors)) + for (QQuickParticleAffector *a : std::as_const(m_affectors)) a->affectSystem(dt); for (QQuickParticleData *d : needsReset) - for (QQuickParticlePainter *p : qAsConst(groupData[d->groupId]->painters)) + for (QQuickParticlePainter *p : std::as_const(groupData[d->groupId]->painters)) p->reload(d); if (oldClear != m_empty) diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp index 6ad9c6f0ac..a1d07e6654 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp @@ -73,7 +73,7 @@ void QV4DebuggerAgent::addDebugger(QV4Debugger *debugger) debugger->setBreakOnThrow(m_breakOnThrow); - for (const BreakPoint &breakPoint : qAsConst(m_breakPoints)) + for (const BreakPoint &breakPoint : std::as_const(m_breakPoints)) if (breakPoint.enabled) debugger->addBreakPoint(breakPoint.fileName, breakPoint.lineNr, breakPoint.condition); @@ -120,7 +120,7 @@ void QV4DebuggerAgent::resumeAll() const int QV4DebuggerAgent::addBreakPoint(const QString &fileName, int lineNumber, bool enabled, const QString &condition) { if (enabled) { - for (QV4Debugger *debugger : qAsConst(m_debuggers)) + for (QV4Debugger *debugger : std::as_const(m_debuggers)) debugger->addBreakPoint(fileName, lineNumber, condition); } @@ -138,7 +138,7 @@ void QV4DebuggerAgent::removeBreakPoint(int id) m_breakPoints.remove(id); if (breakPoint.enabled) - for (QV4Debugger *debugger : qAsConst(m_debuggers)) + for (QV4Debugger *debugger : std::as_const(m_debuggers)) debugger->removeBreakPoint(breakPoint.fileName, breakPoint.lineNr); } @@ -155,7 +155,7 @@ void QV4DebuggerAgent::enableBreakPoint(int id, bool onoff) return; breakPoint.enabled = onoff; - for (QV4Debugger *debugger : qAsConst(m_debuggers)) { + for (QV4Debugger *debugger : std::as_const(m_debuggers)) { if (onoff) debugger->addBreakPoint(breakPoint.fileName, breakPoint.lineNr, breakPoint.condition); else @@ -178,14 +178,14 @@ void QV4DebuggerAgent::setBreakOnThrow(bool onoff) { if (onoff != m_breakOnThrow) { m_breakOnThrow = onoff; - for (QV4Debugger *debugger : qAsConst(m_debuggers)) + for (QV4Debugger *debugger : std::as_const(m_debuggers)) debugger->setBreakOnThrow(onoff); } } void QV4DebuggerAgent::clearAllPauseRequests() { - for (QV4Debugger *debugger : qAsConst(m_debuggers)) + for (QV4Debugger *debugger : std::as_const(m_debuggers)) debugger->clearPauseRequest(); } diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp index 64f0f89ae0..7b9d74a030 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp @@ -734,7 +734,7 @@ void QV4DebugServiceImpl::signalEmitted(const QString &signal) //Normalize to Lower case. QString signalName = signal.left(signal.indexOf(QLatin1Char('('))).toLower(); - for (const QString &signal : qAsConst(breakOnSignals)) { + for (const QString &signal : std::as_const(breakOnSignals)) { if (signal == signalName) { // TODO: pause debugger break; diff --git a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp index f4e90f87ca..fb9ec74dc6 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp @@ -192,7 +192,7 @@ void GlobalInspector::removeWindow(QQuickWindow *window) void GlobalInspector::setParentWindow(QQuickWindow *window, QWindow *parentWindow) { - for (QmlJSDebugger::QQuickWindowInspector *inspector : qAsConst(m_windowInspectors)) { + for (QmlJSDebugger::QQuickWindowInspector *inspector : std::as_const(m_windowInspectors)) { if (inspector->quickWindow() == window) inspector->setParentWindow(parentWindow); } @@ -222,7 +222,7 @@ bool GlobalInspector::syncSelectedItems(const QList<QQuickItem *> &items) selectionChanged = true; connect(item, &QObject::destroyed, this, &GlobalInspector::removeFromSelectedItems); m_selectedItems.append(item); - for (QQuickWindowInspector *inspector : qAsConst(m_windowInspectors)) { + for (QQuickWindowInspector *inspector : std::as_const(m_windowInspectors)) { if (inspector->isEnabled() && inspector->quickWindow() == item->window()) { m_highlightItems.insert(item, new SelectionHighlight(titleForItem(item), item, inspector->overlay())); @@ -284,12 +284,12 @@ void GlobalInspector::processMessage(const QByteArray &message) ds >> requestId >> command; if (command == ENABLE) { - for (QQuickWindowInspector *inspector : qAsConst(m_windowInspectors)) + for (QQuickWindowInspector *inspector : std::as_const(m_windowInspectors)) inspector->setEnabled(true); success = !m_windowInspectors.isEmpty(); } else if (command == DISABLE) { setSelectedItems(QList<QQuickItem*>()); - for (QQuickWindowInspector *inspector : qAsConst(m_windowInspectors)) + for (QQuickWindowInspector *inspector : std::as_const(m_windowInspectors)) inspector->setEnabled(false); success = !m_windowInspectors.isEmpty(); } else if (command == SELECT) { @@ -297,7 +297,7 @@ void GlobalInspector::processMessage(const QByteArray &message) ds >> debugIds; QList<QQuickItem *> selectedObjects; - for (int debugId : qAsConst(debugIds)) { + for (int debugId : std::as_const(debugIds)) { if (QQuickItem *obj = qobject_cast<QQuickItem *>(QQmlDebugService::objectForId(debugId))) selectedObjects << obj; @@ -311,7 +311,7 @@ void GlobalInspector::processMessage(const QByteArray &message) } else if (command == SHOW_APP_ON_TOP) { bool showOnTop; ds >> showOnTop; - for (QmlJSDebugger::QQuickWindowInspector *inspector : qAsConst(m_windowInspectors)) + for (QmlJSDebugger::QQuickWindowInspector *inspector : std::as_const(m_windowInspectors)) inspector->setShowAppOnTop(showOnTop); success = !m_windowInspectors.isEmpty(); } else if (command == CREATE_OBJECT) { diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp index 73a7c28b09..68dcd1add0 100644 --- a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp +++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp @@ -172,7 +172,7 @@ QQmlNativeDebugConnector::QQmlNativeDebugConnector() QQmlNativeDebugConnector::~QQmlNativeDebugConnector() { - for (QQmlDebugService *service : qAsConst(m_services)) { + for (QQmlDebugService *service : std::as_const(m_services)) { service->stateAboutToBeChanged(QQmlDebugService::NotConnected); service->setState(QQmlDebugService::NotConnected); service->stateChanged(QQmlDebugService::NotConnected); @@ -199,12 +199,12 @@ void QQmlNativeDebugConnector::addEngine(QJSEngine *engine) Q_ASSERT(!m_engines.contains(engine)); TRACE_PROTOCOL("Add engine to connector:" << engine); - for (QQmlDebugService *service : qAsConst(m_services)) + for (QQmlDebugService *service : std::as_const(m_services)) service->engineAboutToBeAdded(engine); announceObjectAvailability(QLatin1String("qmlengine"), engine, true); - for (QQmlDebugService *service : qAsConst(m_services)) + for (QQmlDebugService *service : std::as_const(m_services)) service->engineAdded(engine); m_engines.append(engine); @@ -215,12 +215,12 @@ void QQmlNativeDebugConnector::removeEngine(QJSEngine *engine) Q_ASSERT(m_engines.contains(engine)); TRACE_PROTOCOL("Remove engine from connector:" << engine); - for (QQmlDebugService *service : qAsConst(m_services)) + for (QQmlDebugService *service : std::as_const(m_services)) service->engineAboutToBeRemoved(engine); announceObjectAvailability(QLatin1String("qmlengine"), engine, false); - for (QQmlDebugService *service : qAsConst(m_services)) + for (QQmlDebugService *service : std::as_const(m_services)) service->engineRemoved(engine); m_engines.removeOne(engine); diff --git a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp index 16f62d00d2..10d52c75ee 100644 --- a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp @@ -260,7 +260,7 @@ void NativeDebugger::signalEmitted(const QString &signal) //Normalize to Lower case. QString signalName = signal.left(signal.indexOf(QLatin1Char('('))).toLower(); - for (const QString &signal : qAsConst(breakOnSignals)) { + for (const QString &signal : std::as_const(breakOnSignals)) { if (signal == signalName) { // TODO: pause debugger break; @@ -710,7 +710,7 @@ void QQmlNativeDebugServiceImpl::engineAboutToBeRemoved(QJSEngine *engine) void QQmlNativeDebugServiceImpl::stateAboutToBeChanged(QQmlDebugService::State state) { if (state == Enabled) { - for (NativeDebugger *debugger : qAsConst(m_debuggers)) { + for (NativeDebugger *debugger : std::as_const(m_debuggers)) { QV4::ExecutionEngine *engine = debugger->engine(); if (!engine->debugger()) engine->setDebugger(debugger); @@ -734,7 +734,7 @@ void QQmlNativeDebugServiceImpl::messageReceived(const QByteArray &message) } else if (cmd == QLatin1String("echo")) { response.insert(QStringLiteral("result"), arguments); } else { - for (NativeDebugger *debugger : qAsConst(m_debuggers)) + for (NativeDebugger *debugger : std::as_const(m_debuggers)) if (debugger) debugger->handleCommand(&response, cmd, arguments); } diff --git a/src/plugins/qmltooling/qmldbg_preview/proxytranslator.cpp b/src/plugins/qmltooling/qmldbg_preview/proxytranslator.cpp index 557d6a0082..d0004455d7 100644 --- a/src/plugins/qmltooling/qmldbg_preview/proxytranslator.cpp +++ b/src/plugins/qmltooling/qmldbg_preview/proxytranslator.cpp @@ -64,14 +64,14 @@ void ProxyTranslator::setLanguage(const QUrl &context, const QLocale &locale) } // unfortunately setUiLanguage set new translators, so do this first - for (QQmlEngine *engine : qAsConst(m_engines)) + for (QQmlEngine *engine : std::as_const(m_engines)) engine->setUiLanguage(locale.bcp47Name()); // make sure proxy translator is the first used translator QCoreApplication::removeTranslator(this); QCoreApplication::installTranslator(this); - for (QQmlEngine *engine : qAsConst(m_engines)) { + for (QQmlEngine *engine : std::as_const(m_engines)) { // have two retranslate runs to get elided warning even the same language was set m_enable = false; engine->retranslate(); diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.cpp index 859f89367f..04d18b66ef 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.cpp +++ b/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.cpp @@ -109,7 +109,7 @@ public: if (s == false) qWarning() << "disable WatchTextElides is not implemented"; watchTextElides = s; - for (auto &&information : qAsConst(objectTranslationBindingMultiMap)) { + for (auto &&information : std::as_const(objectTranslationBindingMultiMap)) { QObject *scopeObject = information.scopeObject; int elideIndex = scopeObject->metaObject()->indexOfProperty("elide"); if (elideIndex >= 0) { @@ -143,7 +143,7 @@ public: QVector<QmlElement> qmlElements; - for (auto &&information : qAsConst(objectTranslationBindingMultiMap)) { + for (auto &&information : std::as_const(objectTranslationBindingMultiMap)) { QObject *scopeObject = information.scopeObject; auto compilationUnit = information.compilationUnit; @@ -209,7 +209,7 @@ public: packet << Reply::TranslationIssues; QVector<TranslationIssue> issues; - for (auto &&information : qAsConst(objectTranslationBindingMultiMap)) { + for (auto &&information : std::as_const(objectTranslationBindingMultiMap)) { if (!proxyTranslator->hasTranslation(information)) { TranslationIssue issue; issue.type = TranslationIssue::Type::Missing; diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp index 164d01970e..819d46b124 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp @@ -91,10 +91,10 @@ void QQmlEngineControlServiceImpl::stateChanged(State) { // We flush everything for any kind of state change, to avoid complicated timing issues. QMutexLocker lock(&dataMutex); - for (QJSEngine *engine : qAsConst(startingEngines)) + for (QJSEngine *engine : std::as_const(startingEngines)) emit attachedToEngine(engine); startingEngines.clear(); - for (QJSEngine *engine : qAsConst(stoppingEngines)) + for (QJSEngine *engine : std::as_const(stoppingEngines)) emit detachedFromEngine(engine); stoppingEngines.clear(); } diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp index bf70008775..614890a8fd 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp @@ -67,8 +67,8 @@ void QQmlProfilerServiceImpl::dataReady(QQmlAbstractProfilerAdapter *profiler) m_startTimes.insert(0, profiler); if (dataComplete) { QList<QJSEngine *> enginesToRelease; - for (QJSEngine *engine : qAsConst(m_stoppingEngines)) { - const auto range = qAsConst(m_engineProfilers).equal_range(engine); + for (QJSEngine *engine : std::as_const(m_stoppingEngines)) { + const auto range = std::as_const(m_engineProfilers).equal_range(engine); const auto startTimesEnd = m_startTimes.cend(); for (auto it = range.first; it != range.second; ++it) { if (std::find(m_startTimes.cbegin(), startTimesEnd, *it) != startTimesEnd) { @@ -78,7 +78,7 @@ void QQmlProfilerServiceImpl::dataReady(QQmlAbstractProfilerAdapter *profiler) } } sendMessages(); - for (QJSEngine *engine : qAsConst(enginesToRelease)) { + for (QJSEngine *engine : std::as_const(enginesToRelease)) { m_stoppingEngines.removeOne(engine); emit detachedFromEngine(engine); } @@ -114,7 +114,7 @@ void QQmlProfilerServiceImpl::engineAdded(QJSEngine *engine) if (m_globalEnabled) startProfiling(engine, m_globalFeatures); - const auto range = qAsConst(m_engineProfilers).equal_range(engine); + const auto range = std::as_const(m_engineProfilers).equal_range(engine); for (auto it = range.first; it != range.second; ++it) (*it)->stopWaiting(); } @@ -126,7 +126,7 @@ void QQmlProfilerServiceImpl::engineAboutToBeRemoved(QJSEngine *engine) QMutexLocker lock(&m_configMutex); bool isRunning = false; - const auto range = qAsConst(m_engineProfilers).equal_range(engine); + const auto range = std::as_const(m_engineProfilers).equal_range(engine); for (auto it = range.first; it != range.second; ++it) { QQmlAbstractProfilerAdapter *profiler = *it; if (profiler->isRunning()) @@ -147,7 +147,7 @@ void QQmlProfilerServiceImpl::engineRemoved(QJSEngine *engine) "QML profilers have to be removed from the engine thread"); QMutexLocker lock(&m_configMutex); - const auto range = qAsConst(m_engineProfilers).equal_range(engine); + const auto range = std::as_const(m_engineProfilers).equal_range(engine); for (auto it = range.first; it != range.second; ++it) { QQmlAbstractProfilerAdapter *profiler = *it; removeProfilerFromStartTimes(profiler); @@ -172,7 +172,7 @@ void QQmlProfilerServiceImpl::addGlobalProfiler(QQmlAbstractProfilerAdapter *pro // Global profilers are started whenever any engine profiler is started and stopped when // all engine profilers are stopped. quint64 features = 0; - for (QQmlAbstractProfilerAdapter *engineProfiler : qAsConst(m_engineProfilers)) + for (QQmlAbstractProfilerAdapter *engineProfiler : std::as_const(m_engineProfilers)) features |= engineProfiler->features(); if (features != 0) @@ -220,7 +220,7 @@ void QQmlProfilerServiceImpl::startProfiling(QJSEngine *engine, quint64 features d << m_timer.nsecsElapsed() << static_cast<qint32>(Event) << static_cast<qint32>(StartTrace); bool startedAny = false; if (engine != nullptr) { - const auto range = qAsConst(m_engineProfilers).equal_range(engine); + const auto range = std::as_const(m_engineProfilers).equal_range(engine); for (auto it = range.first; it != range.second; ++it) { QQmlAbstractProfilerAdapter *profiler = *it; if (!profiler->isRunning()) { @@ -243,12 +243,12 @@ void QQmlProfilerServiceImpl::startProfiling(QJSEngine *engine, quint64 features startedAny = true; } } - for (QJSEngine *profiledEngine : qAsConst(engines)) + for (QJSEngine *profiledEngine : std::as_const(engines)) d << idForObject(profiledEngine); } if (startedAny) { - for (QQmlAbstractProfilerAdapter *profiler : qAsConst(m_globalProfilers)) { + for (QQmlAbstractProfilerAdapter *profiler : std::as_const(m_globalProfilers)) { if (!profiler->isRunning()) profiler->startProfiling(features); } @@ -291,7 +291,7 @@ void QQmlProfilerServiceImpl::stopProfiling(QJSEngine *engine) if (stopping.isEmpty()) return; - for (QQmlAbstractProfilerAdapter *profiler : qAsConst(m_globalProfilers)) { + for (QQmlAbstractProfilerAdapter *profiler : std::as_const(m_globalProfilers)) { if (!profiler->isRunning()) continue; m_startTimes.insert(-1, profiler); @@ -305,10 +305,10 @@ void QQmlProfilerServiceImpl::stopProfiling(QJSEngine *engine) emit stopFlushTimer(); m_waitingForStop = true; - for (QQmlAbstractProfilerAdapter *profiler : qAsConst(reporting)) + for (QQmlAbstractProfilerAdapter *profiler : std::as_const(reporting)) profiler->reportData(); - for (QQmlAbstractProfilerAdapter *profiler : qAsConst(stopping)) + for (QQmlAbstractProfilerAdapter *profiler : std::as_const(stopping)) profiler->stopProfiling(); } @@ -325,7 +325,7 @@ void QQmlProfilerServiceImpl::sendMessages() << static_cast<qint32>(EndTrace); QSet<QJSEngine *> seen; - for (QQmlAbstractProfilerAdapter *profiler : qAsConst(m_startTimes)) { + for (QQmlAbstractProfilerAdapter *profiler : std::as_const(m_startTimes)) { for (QMultiHash<QJSEngine *, QQmlAbstractProfilerAdapter *>::iterator i(m_engineProfilers.begin()); i != m_engineProfilers.end(); ++i) { if (i.value() == profiler && !seen.contains(i.key())) { @@ -352,7 +352,7 @@ void QQmlProfilerServiceImpl::sendMessages() } bool stillRunning = false; - for (const QQmlAbstractProfilerAdapter *profiler : qAsConst(m_engineProfilers)) { + for (const QQmlAbstractProfilerAdapter *profiler : std::as_const(m_engineProfilers)) { if (profiler->isRunning()) { stillRunning = true; break; @@ -446,21 +446,21 @@ void QQmlProfilerServiceImpl::flush() QMutexLocker lock(&m_configMutex); QList<QQmlAbstractProfilerAdapter *> reporting; - for (QQmlAbstractProfilerAdapter *profiler : qAsConst(m_engineProfilers)) { + for (QQmlAbstractProfilerAdapter *profiler : std::as_const(m_engineProfilers)) { if (profiler->isRunning()) { m_startTimes.insert(-1, profiler); reporting.append(profiler); } } - for (QQmlAbstractProfilerAdapter *profiler : qAsConst(m_globalProfilers)) { + for (QQmlAbstractProfilerAdapter *profiler : std::as_const(m_globalProfilers)) { if (profiler->isRunning()) { m_startTimes.insert(-1, profiler); reporting.append(profiler); } } - for (QQmlAbstractProfilerAdapter *profiler : qAsConst(reporting)) + for (QQmlAbstractProfilerAdapter *profiler : std::as_const(reporting)) profiler->reportData(); } diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserverfactory.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserverfactory.cpp index 8ecbfdeef8..9107715f28 100644 --- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserverfactory.cpp +++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserverfactory.cpp @@ -558,12 +558,12 @@ void QQmlDebugServerImpl::addEngine(QJSEngine *engine) QMutexLocker locker(&m_helloMutex); Q_ASSERT(!m_engineConditions.contains(engine)); - for (QQmlDebugService *service : qAsConst(m_plugins)) + for (QQmlDebugService *service : std::as_const(m_plugins)) service->engineAboutToBeAdded(engine); m_engineConditions[engine].waitForServices(&m_helloMutex, m_plugins.size()); - for (QQmlDebugService *service : qAsConst(m_plugins)) + for (QQmlDebugService *service : std::as_const(m_plugins)) service->engineAdded(engine); } @@ -575,12 +575,12 @@ void QQmlDebugServerImpl::removeEngine(QJSEngine *engine) QMutexLocker locker(&m_helloMutex); Q_ASSERT(m_engineConditions.contains(engine)); - for (QQmlDebugService *service : qAsConst(m_plugins)) + for (QQmlDebugService *service : std::as_const(m_plugins)) service->engineAboutToBeRemoved(engine); m_engineConditions[engine].waitForServices(&m_helloMutex, m_plugins.size()); - for (QQmlDebugService *service : qAsConst(m_plugins)) + for (QQmlDebugService *service : std::as_const(m_plugins)) service->engineRemoved(engine); m_engineConditions.remove(engine); diff --git a/src/plugins/scenegraph/openvg/qsgopenvginternalrectanglenode.cpp b/src/plugins/scenegraph/openvg/qsgopenvginternalrectanglenode.cpp index 7eb9cfd4a5..988a999e19 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvginternalrectanglenode.cpp +++ b/src/plugins/scenegraph/openvg/qsgopenvginternalrectanglenode.cpp @@ -73,7 +73,7 @@ void QSGOpenVGInternalRectangleNode::setGradientStops(const QGradientStops &stop //normalize stops bool needsNormalization = false; - for (const QGradientStop &stop : qAsConst(stops)) { + for (const QGradientStop &stop : std::as_const(stops)) { if (stop.first < 0.0 || stop.first > 1.0) { needsNormalization = true; continue; @@ -218,7 +218,7 @@ void QSGOpenVGInternalRectangleNode::render() vgSetParameteri(m_rectanglePaint, VG_PAINT_COLOR_RAMP_PREMULTIPLIED, false); QVector<VGfloat> stops; - for (const QGradientStop &stop : qAsConst(m_gradientStops)) { + for (const QGradientStop &stop : std::as_const(m_gradientStops)) { // offset stops.append(stop.first); // color diff --git a/src/plugins/scenegraph/openvg/qsgopenvgnodevisitor.cpp b/src/plugins/scenegraph/openvg/qsgopenvgnodevisitor.cpp index 1aac62675c..39905673ff 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvgnodevisitor.cpp +++ b/src/plugins/scenegraph/openvg/qsgopenvgnodevisitor.cpp @@ -81,7 +81,7 @@ void QSGOpenVGNodeVisitor::endVisit(QSGClipNode *) vgMask(0,VG_FILL_MASK, 0, 0, VG_MAXINT, VG_MAXINT); vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE); vgLoadIdentity(); - for (auto path : qAsConst(m_clipStack)) { + for (auto path : std::as_const(m_clipStack)) { vgRenderToMask(path, VG_FILL_PATH, VG_INTERSECT_MASK); } } diff --git a/src/qml/animations/qabstractanimationjob.cpp b/src/qml/animations/qabstractanimationjob.cpp index 6224d033fe..7bb2af476c 100644 --- a/src/qml/animations/qabstractanimationjob.cpp +++ b/src/qml/animations/qabstractanimationjob.cpp @@ -48,11 +48,11 @@ void QQmlAnimationTimer::unsetJobTimer(QAbstractAnimationJob *animation) QQmlAnimationTimer::~QQmlAnimationTimer() { - for (const auto &animation : qAsConst(animations)) + for (const auto &animation : std::as_const(animations)) unsetJobTimer(animation); - for (const auto &animation : qAsConst(animationsToStart)) + for (const auto &animation : std::as_const(animationsToStart)) unsetJobTimer(animation); - for (const auto &animation : qAsConst(runningPauseAnimations)) + for (const auto &animation : std::as_const(runningPauseAnimations)) unsetJobTimer(animation); } diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp index 5beeda930f..92b1d897e3 100644 --- a/src/qml/compiler/qqmlirbuilder.cpp +++ b/src/qml/compiler/qqmlirbuilder.cpp @@ -1391,7 +1391,7 @@ bool IRBuilder::resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, O // If it's a namespace, prepend the qualifier and we'll resolve it later to the correct type. QString currentName = qualifiedIdElement->name.toString(); if (qualifiedIdElement->next) { - for (const QV4::CompiledData::Import* import : qAsConst(_imports)) + for (const QV4::CompiledData::Import* import : std::as_const(_imports)) if (import->qualifierIndex != emptyStringIndex && stringAt(import->qualifierIndex) == currentName) { qualifiedIdElement = qualifiedIdElement->next; @@ -1522,7 +1522,7 @@ void QmlUnitGenerator::generate(Document &output, const QV4::CompiledData::Depen jsUnit = createdUnit = output.jsGenerator.generateUnit(); // enable flag if we encountered pragma Singleton - for (Pragma *p : qAsConst(output.pragmas)) { + for (Pragma *p : std::as_const(output.pragmas)) { switch (p->type) { case Pragma::Singleton: createdUnit->flags |= Unit::IsSingleton; @@ -1579,7 +1579,7 @@ void QmlUnitGenerator::generate(Document &output, const QV4::CompiledData::Depen const unsigned int objectOffset = sizeof(QV4::CompiledData::QmlUnit) + importSize; uint nextOffset = objectOffset + objectOffsetTableSize; - for (Object *o : qAsConst(output.objects)) { + for (Object *o : std::as_const(output.objects)) { objectOffsets.insert(o, nextOffset); nextOffset += QV4::CompiledData::Object::calculateSizeExcludingSignalsAndEnums(o->functionCount(), o->propertyCount(), o->aliasCount(), o->enumCount(), o->signalCount(), o->bindingCount(), o->namedObjectsInComponent.size(), o->inlineComponentCount(), o->requiredPropertyExtraDataCount()); @@ -1607,7 +1607,7 @@ void QmlUnitGenerator::generate(Document &output, const QV4::CompiledData::Depen // write imports char *importPtr = data + qmlUnit->offsetToImports; - for (const QV4::CompiledData::Import *imp : qAsConst(output.imports)) { + for (const QV4::CompiledData::Import *imp : std::as_const(output.imports)) { QV4::CompiledData::Import *importToWrite = reinterpret_cast<QV4::CompiledData::Import*>(importPtr); *importToWrite = *imp; importPtr += sizeof(QV4::CompiledData::Import); diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp index 3d8594214b..bab1f026c3 100644 --- a/src/qml/compiler/qv4compiler.cpp +++ b/src/qml/compiler/qv4compiler.cpp @@ -209,7 +209,7 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit(GeneratorO { registerString(module->fileName); registerString(module->finalUrl); - for (Context *f : qAsConst(module->functions)) { + for (Context *f : std::as_const(module->functions)) { registerString(f->name); registerString(f->returnType); for (int i = 0; i < f->arguments.size(); ++i) { @@ -219,7 +219,7 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit(GeneratorO for (int i = 0; i < f->locals.size(); ++i) registerString(f->locals.at(i)); } - for (Context *c : qAsConst(module->blocks)) { + for (Context *c : std::as_const(module->blocks)) { for (int i = 0; i < c->locals.size(); ++i) registerString(c->locals.at(i)); } @@ -290,7 +290,7 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit(GeneratorO } CompiledData::Lookup *lookupsToWrite = reinterpret_cast<CompiledData::Lookup*>(dataPtr + unit->offsetToLookupTable); - for (const CompiledData::Lookup &l : qAsConst(lookups)) + for (const CompiledData::Lookup &l : std::as_const(lookups)) *lookupsToWrite++ = l; CompiledData::RegExp *regexpTable = reinterpret_cast<CompiledData::RegExp *>(dataPtr + unit->offsetToRegexpTable); diff --git a/src/qml/compiler/qv4compilercontext.cpp b/src/qml/compiler/qv4compilercontext.cpp index 696bffa23b..1d4b0bde17 100644 --- a/src/qml/compiler/qv4compilercontext.cpp +++ b/src/qml/compiler/qv4compilercontext.cpp @@ -272,7 +272,7 @@ void Context::emitBlockHeader(Codegen *codegen) codegen->referenceForName(QStringLiteral("arguments"), false).storeConsumeAccumulator(); } - for (const Context::Member &member : qAsConst(members)) { + for (const Context::Member &member : std::as_const(members)) { if (member.function) { const int function = codegen->defineFunction(member.function->name.toString(), member.function, member.function->formals, member.function->body); codegen->loadClosure(function); @@ -361,7 +361,7 @@ void Context::setupFunctionIndices(Moth::BytecodeGenerator *bytecodeGenerator) } sizeOfLocalTemporalDeadZone = localsInTDZ.size(); - for (auto &member: qAsConst(localsInTDZ)) { + for (auto &member: std::as_const(localsInTDZ)) { member->index = locals.size(); locals.append(member.key()); } @@ -377,7 +377,7 @@ void Context::setupFunctionIndices(Moth::BytecodeGenerator *bytecodeGenerator) sizeOfRegisterTemporalDeadZone = registersInTDZ.size(); firstTemporalDeadZoneRegister = bytecodeGenerator->currentRegister(); - for (auto &member: qAsConst(registersInTDZ)) + for (auto &member: std::as_const(registersInTDZ)) member->index = bytecodeGenerator->newRegister(); nRegisters = bytecodeGenerator->currentRegister() - registerOffset; diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp index ee54137c10..157d2896aa 100644 --- a/src/qml/compiler/qv4compilerscanfunctions.cpp +++ b/src/qml/compiler/qv4compilerscanfunctions.cpp @@ -308,7 +308,7 @@ bool ScanFunctions::visit(PatternElement *ast) declarationLocation.length = ast->lastSourceLocation().end() - declarationLocation.offset; } - for (const auto &name : qAsConst(names)) { + for (const auto &name : std::as_const(names)) { if (_context->isStrict && (name.id == QLatin1String("eval") || name.id == QLatin1String("arguments"))) _cg->throwSyntaxError(ast->identifierToken, QStringLiteral("Variable name may not be eval or arguments in strict mode")); checkName(QStringView(name.id), ast->identifierToken); @@ -721,7 +721,7 @@ void ScanFunctions::calcEscapingVariables() { Module *m = _cg->_module; - for (Context *inner : qAsConst(m->contextMap)) { + for (Context *inner : std::as_const(m->contextMap)) { if (inner->usesArgumentsObject != Context::ArgumentsObjectUsed) continue; if (inner->contextType != ContextType::Block && !inner->isArrowFunction) @@ -733,7 +733,7 @@ void ScanFunctions::calcEscapingVariables() c->usesArgumentsObject = Context::ArgumentsObjectUsed; inner->usesArgumentsObject = Context::ArgumentsObjectNotUsed; } - for (Context *inner : qAsConst(m->contextMap)) { + for (Context *inner : std::as_const(m->contextMap)) { if (!inner->parent || inner->usesArgumentsObject == Context::ArgumentsObjectUnknown) inner->usesArgumentsObject = Context::ArgumentsObjectNotUsed; if (inner->usesArgumentsObject == Context::ArgumentsObjectUsed) { @@ -746,7 +746,7 @@ void ScanFunctions::calcEscapingVariables() } } - for (Context *c : qAsConst(m->contextMap)) { + for (Context *c : std::as_const(m->contextMap)) { if (c->contextType != ContextType::ESModule) continue; for (const auto &entry: c->exportEntries) { @@ -757,8 +757,8 @@ void ScanFunctions::calcEscapingVariables() break; } - for (Context *inner : qAsConst(m->contextMap)) { - for (const QString &var : qAsConst(inner->usedVariables)) { + for (Context *inner : std::as_const(m->contextMap)) { + for (const QString &var : std::as_const(inner->usedVariables)) { Context *c = inner; while (c) { Context *current = c; @@ -820,7 +820,7 @@ void ScanFunctions::calcEscapingVariables() c->innerFunctionAccessesThis |= innerFunctionAccessesThis; } } - for (Context *c : qAsConst(m->contextMap)) { + for (Context *c : std::as_const(m->contextMap)) { if (c->innerFunctionAccessesThis) { // add an escaping 'this' variable c->addLocalVar(QStringLiteral("this"), Context::VariableDefinition, VariableScope::Let); @@ -846,7 +846,7 @@ void ScanFunctions::calcEscapingVariables() c->requiresExecutionContext = true; c->argumentsCanEscape = true; } else { - for (const auto &m : qAsConst(c->members)) { + for (const auto &m : std::as_const(c->members)) { if (m.isLexicallyScoped()) { c->requiresExecutionContext = true; break; @@ -867,7 +867,7 @@ void ScanFunctions::calcEscapingVariables() // we don't know if the code is a signal handler or not. c->requiresExecutionContext = true; if (c->allVarsEscape) { - for (const auto &m : qAsConst(c->members)) + for (const auto &m : std::as_const(c->members)) m.canEscape = true; } } @@ -875,7 +875,7 @@ void ScanFunctions::calcEscapingVariables() static const bool showEscapingVars = qEnvironmentVariableIsSet("QV4_SHOW_ESCAPING_VARS"); if (showEscapingVars) { qDebug() << "==== escaping variables ===="; - for (Context *c : qAsConst(m->contextMap)) { + for (Context *c : std::as_const(m->contextMap)) { qDebug() << "Context" << c << c->name << "requiresExecutionContext" << c->requiresExecutionContext << "isStrict" << c->isStrict; qDebug() << " isArrowFunction" << c->isArrowFunction << "innerFunctionAccessesThis" << c->innerFunctionAccessesThis; qDebug() << " parent:" << c->parent; diff --git a/src/qml/debugger/qqmlconfigurabledebugservice_p.h b/src/qml/debugger/qqmlconfigurabledebugservice_p.h index 8451f4e800..ce911c5baf 100644 --- a/src/qml/debugger/qqmlconfigurabledebugservice_p.h +++ b/src/qml/debugger/qqmlconfigurabledebugservice_p.h @@ -37,7 +37,7 @@ protected: { QMutexLocker lock(&m_configMutex); m_waitingForConfiguration = false; - for (QJSEngine *engine : qAsConst(m_waitingEngines)) + for (QJSEngine *engine : std::as_const(m_waitingEngines)) Q_EMIT Base::attachedToEngine(engine); m_waitingEngines.clear(); } diff --git a/src/qml/doc/snippets/qmltc/tst_qmltc_examples.cpp b/src/qml/doc/snippets/qmltc/tst_qmltc_examples.cpp index c933adfcaf..f82b9f6d39 100644 --- a/src/qml/doc/snippets/qmltc/tst_qmltc_examples.cpp +++ b/src/qml/doc/snippets/qmltc/tst_qmltc_examples.cpp @@ -162,7 +162,7 @@ void tst_qmltc_examples::helloWorld() QVERIFY(!documentationCode.isEmpty()); auto begin = generatedCode.cbegin(); - for (const QString &existingString : qAsConst(documentationCode)) { + for (const QString &existingString : std::as_const(documentationCode)) { auto pos = std::find(begin, generatedCode.cend(), existingString); QVERIFY2(pos != generatedCode.cend(), qPrintable(u"Could not find: " + existingString)); begin = std::next(pos); diff --git a/src/qml/jsruntime/qv4executableallocator.cpp b/src/qml/jsruntime/qv4executableallocator.cpp index f8b005e914..5a63230858 100644 --- a/src/qml/jsruntime/qv4executableallocator.cpp +++ b/src/qml/jsruntime/qv4executableallocator.cpp @@ -125,7 +125,7 @@ ExecutableAllocator::ExecutableAllocator() ExecutableAllocator::~ExecutableAllocator() { - for (ChunkOfPages *chunk : qAsConst(chunks)) { + for (ChunkOfPages *chunk : std::as_const(chunks)) { for (Allocation *allocation = chunk->firstAllocation; allocation; allocation = allocation->next) if (!allocation->free) allocation->invalidate(); diff --git a/src/qml/jsruntime/qv4executablecompilationunit.cpp b/src/qml/jsruntime/qv4executablecompilationunit.cpp index c0e6a71980..744a463648 100644 --- a/src/qml/jsruntime/qv4executablecompilationunit.cpp +++ b/src/qml/jsruntime/qv4executablecompilationunit.cpp @@ -297,7 +297,7 @@ void ExecutableCompilationUnit::unlink() delete [] runtimeLookups; runtimeLookups = nullptr; - for (QV4::Function *f : qAsConst(runtimeFunctions)) + for (QV4::Function *f : std::as_const(runtimeFunctions)) f->destroy(); runtimeFunctions.clear(); @@ -325,14 +325,14 @@ void ExecutableCompilationUnit::markObjects(QV4::MarkStack *markStack) if (runtimeClasses[i]) runtimeClasses[i]->mark(markStack); } - for (QV4::Function *f : qAsConst(runtimeFunctions)) + for (QV4::Function *f : std::as_const(runtimeFunctions)) if (f && f->internalClass) f->internalClass->mark(markStack); - for (QV4::Heap::InternalClass *c : qAsConst(runtimeBlocks)) + for (QV4::Heap::InternalClass *c : std::as_const(runtimeBlocks)) if (c) c->mark(markStack); - for (QV4::Heap::Object *o : qAsConst(templateObjects)) + for (QV4::Heap::Object *o : std::as_const(templateObjects)) if (o) o->mark(markStack); diff --git a/src/qml/jsruntime/qv4identifiertable.cpp b/src/qml/jsruntime/qv4identifiertable.cpp index e3cde9b7c7..96aa54018b 100644 --- a/src/qml/jsruntime/qv4identifiertable.cpp +++ b/src/qml/jsruntime/qv4identifiertable.cpp @@ -25,7 +25,7 @@ IdentifierTable::~IdentifierTable() { free(entriesByHash); free(entriesById); - for (const auto &h : qAsConst(idHashes)) + for (const auto &h : std::as_const(idHashes)) h->identifierTable = nullptr; } diff --git a/src/qml/jsruntime/qv4profiling.cpp b/src/qml/jsruntime/qv4profiling.cpp index 19da26989f..db33cd27f9 100644 --- a/src/qml/jsruntime/qv4profiling.cpp +++ b/src/qml/jsruntime/qv4profiling.cpp @@ -60,7 +60,7 @@ void Profiler::reportData() FunctionLocationHash locations; properties.reserve(m_data.size()); - for (const FunctionCall &call : qAsConst(m_data)) { + for (const FunctionCall &call : std::as_const(m_data)) { properties.append(call.properties()); Function *function = call.function(); SentMarker &marker = m_sentLocations[reinterpret_cast<quintptr>(function)]; diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 768482267c..f4dfc7850a 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -144,7 +144,7 @@ struct RuntimeCounters::Data { } std::sort(lines.begin(), lines.end(), Line::less); outs << lines.size() << " counters:" << endl; - for (const Line &line : qAsConst(lines)) + for (const Line &line : std::as_const(lines)) outs << qSetFieldWidth(10) << line.count << qSetFieldWidth(0) << " | " << line.func << " | " << pretty(line.tag1) diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp index 72a287c318..07a8f1e278 100644 --- a/src/qml/qml/qqml.cpp +++ b/src/qml/qml/qqml.cpp @@ -581,7 +581,7 @@ int QQmlPrivate::qmlregister(RegistrationType type, void *data) auto revisions = prepareRevisions(type.instanceMetaObject, added) + furtherRevisions; uniqueRevisions(&revisions, type.version, added); - for (QTypeRevision revision : qAsConst(revisions)) { + for (QTypeRevision revision : std::as_const(revisions)) { if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion()) break; @@ -624,7 +624,7 @@ int QQmlPrivate::qmlregister(RegistrationType type, void *data) revisions.append(added); uniqueRevisions(&revisions, type.version, added); - for (QTypeRevision revision : qAsConst(revisions)) { + for (QTypeRevision revision : std::as_const(revisions)) { if (revision < added) continue; if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion()) diff --git a/src/qml/qml/qqmlapplicationengine.cpp b/src/qml/qml/qqmlapplicationengine.cpp index df8c64dab0..0a93e3b73e 100644 --- a/src/qml/qml/qqmlapplicationengine.cpp +++ b/src/qml/qml/qqmlapplicationengine.cpp @@ -26,7 +26,7 @@ QQmlApplicationEnginePrivate::~QQmlApplicationEnginePrivate() void QQmlApplicationEnginePrivate::cleanUp() { Q_Q(QQmlApplicationEngine); - for (auto obj : qAsConst(objects)) + for (auto obj : std::as_const(objects)) obj->disconnect(q); qDeleteAll(objects); diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 2cc7cc4d37..46def51001 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -408,7 +408,7 @@ QQmlComponent::~QQmlComponent() if (isError()) { qWarning() << "This may have been caused by one of the following errors:"; - for (const QQmlError &error : qAsConst(d->state.errors)) + for (const QQmlError &error : std::as_const(d->state.errors)) qWarning().nospace().noquote() << QLatin1String(" ") << error; } @@ -924,7 +924,7 @@ QObject *QQmlComponentPrivate::beginCreate(QQmlRefPointer<QQmlContextData> conte Q_Q(QQmlComponent); auto cleanup = qScopeGuard([this] { if (!state.errors.isEmpty() && lcQmlComponentGeneral().isDebugEnabled()) { - for (const auto &e : qAsConst(state.errors)) { + for (const auto &e : std::as_const(state.errors)) { qCDebug(lcQmlComponentGeneral) << "QQmlComponent: " << e.toString(); } } @@ -996,7 +996,7 @@ void QQmlComponentPrivate::beginDeferred(QQmlEnginePrivate *enginePriv, deferredState->reserve(ddata->deferredData.size()); - for (QQmlData::DeferredData *deferredData : qAsConst(ddata->deferredData)) { + for (QQmlData::DeferredData *deferredData : std::as_const(ddata->deferredData)) { enginePriv->inProgressCreations++; ConstructionState state; @@ -1586,7 +1586,7 @@ QObject *QQmlComponent::createObject(QObject *parent, const QVariantMap &propert if (!d->requiredProperties().empty()) { QList<QQmlError> errors; - for (const auto &requiredProperty: qAsConst(d->requiredProperties())) { + for (const auto &requiredProperty: std::as_const(d->requiredProperties())) { errors.push_back(QQmlComponentPrivate::unsetRequiredPropertyToQQmlError( requiredProperty)); } diff --git a/src/qml/qml/qqmldatablob.cpp b/src/qml/qml/qqmldatablob.cpp index 0cb685ac7f..a8a4537844 100644 --- a/src/qml/qml/qqmldatablob.cpp +++ b/src/qml/qml/qqmldatablob.cpp @@ -313,7 +313,7 @@ void QQmlDataBlob::addDependency(QQmlDataBlob *blob) status() == Error || status() == Complete || m_isDone) return; - for (const auto &existingDep: qAsConst(m_waitingFor)) + for (const auto &existingDep: std::as_const(m_waitingFor)) if (existingDep.data() == blob) return; diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index 37cc6bd2c6..75cc0fb8ce 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -1010,7 +1010,7 @@ QString QQmlImports::resolvedUri(const QString &dir_arg, QQmlImportDatabase *dat std::sort(paths.begin(), paths.end(), std::greater<QString>()); // Ensure subdirs preceed their parents. QString stableRelativePath = dir; - for (const QString &path : qAsConst(paths)) { + for (const QString &path : std::as_const(paths)) { if (dir.startsWith(path)) { stableRelativePath = dir.mid(path.size()+1); break; diff --git a/src/qml/qml/qqmllist.h b/src/qml/qml/qqmllist.h index af2326abc4..4c1455b2e2 100644 --- a/src/qml/qml/qqmllist.h +++ b/src/qml/qml/qqmllist.h @@ -118,7 +118,7 @@ private: for (qsizetype i = 0; i < length; ++i) stash.append(i == idx ? v : list->at(list, i)); list->clear(list); - for (T *item : qAsConst(stash)) + for (T *item : std::as_const(stash)) list->append(list, item); } else { stash.reserve(length - idx - 1); @@ -149,7 +149,7 @@ private: for (qsizetype i = 0; i < length; ++i) stash.append(list->at(list, i)); list->clear(list); - for (T *item : qAsConst(stash)) + for (T *item : std::as_const(stash)) list->append(list, item); } }; diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index f6adbd30a2..9245a03cc6 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -834,7 +834,7 @@ QQmlMetaType::RegistrationResult QQmlMetaType::registerPluginTypes( if (!failures.isEmpty()) { if (errors) { - for (const QString &failure : qAsConst(failures)) { + for (const QString &failure : std::as_const(failures)) { QQmlError error; error.setDescription(failure); errors->prepend(error); @@ -1406,7 +1406,7 @@ void QQmlMetaType::registerMetaObjectForType(const QMetaObject *metaobject, QQml static bool hasActiveInlineComponents(const QQmlTypePrivate *d) { - for (const QQmlType &ic : qAsConst(d->objectIdToICType)) { + for (const QQmlType &ic : std::as_const(d->objectIdToICType)) { const QQmlTypePrivate *icPriv = ic.priv(); if (icPriv && icPriv->count() > 1) return true; @@ -1513,7 +1513,7 @@ QList<QQmlType> QQmlMetaType::qmlSingletonTypes() const QQmlMetaTypeDataPtr data; QList<QQmlType> retn; - for (const auto t : qAsConst(data->nameToType)) { + for (const auto t : std::as_const(data->nameToType)) { QQmlType type(t); if (type.isSingleton()) retn.append(type); @@ -1525,7 +1525,7 @@ const QQmlPrivate::CachedQmlUnit *QQmlMetaType::findCachedCompilationUnit(const { const QQmlMetaTypeDataPtr data; - for (const auto lookup : qAsConst(data->lookupCachedQmlUnit)) { + for (const auto lookup : std::as_const(data->lookupCachedQmlUnit)) { if (const QQmlPrivate::CachedQmlUnit *unit = lookup(uri)) { QString error; if (!QV4::ExecutableCompilationUnit::verifyHeader(unit->qmlData, QDateTime(), &error)) { diff --git a/src/qml/qml/qqmlopenmetaobject.cpp b/src/qml/qml/qqmlopenmetaobject.cpp index b9934eb76a..cf51286677 100644 --- a/src/qml/qml/qqmlopenmetaobject.cpp +++ b/src/qml/qml/qqmlopenmetaobject.cpp @@ -375,7 +375,7 @@ void QQmlOpenMetaObject::setValues(const QHash<QByteArray, QVariant> &values, bo d->type->createProperties(missingProperties); d->dropPropertyCache(); - for (const QByteArray &name : qAsConst(missingProperties)) + for (const QByteArray &name : std::as_const(missingProperties)) checkedSetValue(names[name], values[name], force); } diff --git a/src/qml/qml/qqmlpluginimporter.cpp b/src/qml/qml/qqmlpluginimporter.cpp index a29a3101ec..0b14d1f561 100644 --- a/src/qml/qml/qqmlpluginimporter.cpp +++ b/src/qml/qml/qqmlpluginimporter.cpp @@ -129,7 +129,7 @@ static bool unloadPlugin(const std::pair<const QString, QmlPlugin> &plugin) void qmlClearEnginePlugins() { PluginMapPtr plugins(qmlPluginsById()); - for (const auto &plugin : qAsConst(*plugins)) + for (const auto &plugin : std::as_const(*plugins)) unloadPlugin(plugin); plugins->clear(); } @@ -395,7 +395,7 @@ QString QQmlPluginImporter::resolvePlugin(const QString &qmldirPluginPath, const if (!qmldirPluginPathIsRelative) searchPaths.prepend(qmldirPluginPath); - for (const QString &pluginPath : qAsConst(searchPaths)) { + for (const QString &pluginPath : std::as_const(searchPaths)) { QString resolvedBasePath; if (pluginPath == QLatin1String(".")) { if (qmldirPluginPathIsRelative && !qmldirPluginPath.isEmpty() @@ -550,7 +550,7 @@ QTypeRevision QQmlPluginImporter::importPlugins() { return QTypeRevision(); for (const QString &versionUri : versionUris) { - for (const StaticPluginData &pair : qAsConst(pluginPairs)) { + for (const StaticPluginData &pair : std::as_const(pluginPairs)) { for (const QJsonValueConstRef metaTagUri : pair.uriList) { if (versionUri == metaTagUri.toString()) { staticPluginsFound++; diff --git a/src/qml/qml/qqmlpropertycachecreator_p.h b/src/qml/qml/qqmlpropertycachecreator_p.h index 42345448a6..1901688174 100644 --- a/src/qml/qml/qqmlpropertycachecreator_p.h +++ b/src/qml/qml/qqmlpropertycachecreator_p.h @@ -830,7 +830,7 @@ inline void QQmlPropertyCacheAliasCreator<ObjectContainer>::appendAliasPropertie do { QVector<int> pendingObjects; - for (int objectIndex: qAsConst(objectsWithAliases)) { + for (int objectIndex: std::as_const(objectsWithAliases)) { const CompiledObject &object = *objectContainer->objectAt(objectIndex); if (allAliasTargetsExist(object)) { diff --git a/src/qml/qml/qqmltype.cpp b/src/qml/qml/qqmltype.cpp index c6f948e355..52437348d9 100644 --- a/src/qml/qml/qqmltype.cpp +++ b/src/qml/qml/qqmltype.cpp @@ -371,7 +371,7 @@ void QQmlTypePrivate::createEnumConflictReport(const QMetaObject *metaObject, co qWarning().noquote() << QLatin1String("Possible conflicting items:"); // find items with conflicting key - for (const auto &i : qAsConst(enumInfoList)) { + for (const auto &i : std::as_const(enumInfoList)) { if (i.enumKey == conflictingKey) qWarning().noquote().nospace() << " " << i.metaObjectName << "." << i.enumName << "." << i.enumKey << " from scope " << i.metaEnumScope << " injected by " << i.path.join(QLatin1String("->")); diff --git a/src/qml/qml/qqmltypecompiler.cpp b/src/qml/qml/qqmltypecompiler.cpp index f2fddae3f7..c2aff473fd 100644 --- a/src/qml/qml/qqmltypecompiler.cpp +++ b/src/qml/qml/qqmltypecompiler.cpp @@ -117,7 +117,7 @@ QQmlRefPointer<QV4::ExecutableCompilationUnit> QQmlTypeCompiler::compile() document->jsModule.fileName = typeData->urlString(); document->jsModule.finalUrl = typeData->finalUrlString(); QmlIR::JSCodeGen v4CodeGenerator(document, engine->v4engine()->illegalNames()); - for (QmlIR::Object *object : qAsConst(document->objects)) { + for (QmlIR::Object *object : std::as_const(document->objects)) { if (!v4CodeGenerator.generateRuntimeFunctions(object)) { Q_ASSERT(v4CodeGenerator.hasError()); recordError(v4CodeGenerator.error()); @@ -1016,7 +1016,7 @@ bool QQmlComponentAndAliasResolver::resolveAliases(int componentIndex) atLeastOneAliasResolved = false; QVector<int> pendingObjects; - for (int objectIndex: qAsConst(_objectsWithAliases)) { + for (int objectIndex: std::as_const(_objectsWithAliases)) { QQmlError error; const auto result = resolveAliasesInObject(objectIndex, &error); diff --git a/src/qml/qml/qqmltypedata.cpp b/src/qml/qml/qqmltypedata.cpp index 899192adbd..c56acaef0d 100644 --- a/src/qml/qml/qqmltypedata.cpp +++ b/src/qml/qml/qqmltypedata.cpp @@ -309,7 +309,7 @@ void QQmlTypeData::done() } // Check all type dependencies for errors - for (auto it = qAsConst(m_resolvedTypes).begin(), end = qAsConst(m_resolvedTypes).end(); it != end; + for (auto it = std::as_const(m_resolvedTypes).begin(), end = std::as_const(m_resolvedTypes).end(); it != end; ++it) { const TypeReference &type = *it; Q_ASSERT(!type.typeData || type.typeData->isCompleteOrError() || type.type.isInlineComponentType()); @@ -470,7 +470,7 @@ void QQmlTypeData::done() auto type = QQmlMetaType::typeForUrl(finalUrlString(), hashedStringRef, false, &errors); Q_ASSERT(errors.empty()); if (type.isValid()) { - for (auto const &icDatum : qAsConst(m_inlineComponentData)) { + for (auto const &icDatum : std::as_const(m_inlineComponentData)) { Q_ASSERT(icDatum.typeIds.isValid()); QQmlType existingType = type.lookupInlineComponentById(type.lookupInlineComponentIdByName(m_compiledData->stringAt(icDatum.nameIndex))); type.associateInlineComponent(m_compiledData->stringAt(icDatum.nameIndex), @@ -600,7 +600,7 @@ bool QQmlTypeData::loadFromSource() if (!compiler.generateFromQml(source, finalUrlString(), m_document.data())) { QList<QQmlError> errors; errors.reserve(compiler.errors.size()); - for (const QQmlJS::DiagnosticMessage &msg : qAsConst(compiler.errors)) { + for (const QQmlJS::DiagnosticMessage &msg : std::as_const(compiler.errors)) { QQmlError e; e.setUrl(url()); e.setLine(qmlConvertSourceCoordinate<quint32, int>(msg.loc.startLine)); @@ -668,7 +668,7 @@ void QQmlTypeData::continueLoadFromIR() QList<QQmlError> errors; - for (const QV4::CompiledData::Import *import : qAsConst(m_document->imports)) { + for (const QV4::CompiledData::Import *import : std::as_const(m_document->imports)) { if (!addImport(import, {}, &errors)) { Q_ASSERT(errors.size()); diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 60403c1bad..f4677b6848 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -1436,7 +1436,7 @@ void QQmlXMLHttpRequest::finished() void QQmlXMLHttpRequest::readEncoding() { - for (const HeaderPair &header : qAsConst(m_headersList)) { + for (const HeaderPair &header : std::as_const(m_headersList)) { if (header.first == "content-type") { int separatorIdx = header.second.indexOf(';'); if (separatorIdx == -1) { diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp index cb1148a416..e10327e240 100644 --- a/src/qml/types/qqmlconnections.cpp +++ b/src/qml/types/qqmlconnections.cpp @@ -138,7 +138,7 @@ void QQmlConnections::setTarget(QObject *obj) if (d->targetSet && d->target == obj) return; d->targetSet = true; // even if setting to 0, it is *set* - for (QQmlBoundSignal *s : qAsConst(d->boundsignals)) { + for (QQmlBoundSignal *s : std::as_const(d->boundsignals)) { // It is possible that target is being changed due to one of our signal // handlers -> use deleteLater(). if (s->isNotifying()) @@ -174,7 +174,7 @@ void QQmlConnections::setEnabled(bool enabled) d->enabled = enabled; - for (QQmlBoundSignal *s : qAsConst(d->boundsignals)) + for (QQmlBoundSignal *s : std::as_const(d->boundsignals)) s->setEnabled(d->enabled); emit enabledChanged(); @@ -321,7 +321,7 @@ void QQmlConnections::connectSignalsToBindings() QQmlData *ddata = QQmlData::get(this); QQmlRefPointer<QQmlContextData> ctxtdata = ddata ? ddata->outerContext : nullptr; - for (const QV4::CompiledData::Binding *binding : qAsConst(d->bindings)) { + for (const QV4::CompiledData::Binding *binding : std::as_const(d->bindings)) { Q_ASSERT(binding->type() == QV4::CompiledData::Binding::Type_Script); QString propName = d->compilationUnit->stringAt(binding->propertyNameIndex); diff --git a/src/qmlcompiler/qqmljsbasicblocks.cpp b/src/qmlcompiler/qqmljsbasicblocks.cpp index b014e2a482..093b11684c 100644 --- a/src/qmlcompiler/qqmljsbasicblocks.cpp +++ b/src/qmlcompiler/qqmljsbasicblocks.cpp @@ -430,7 +430,7 @@ void QQmlJSBasicBlocks::adjustTypes() valueType); } - for (const QList<int> &conversions : qAsConst(it->registerReadersAndConversions)) { + for (const QList<int> &conversions : std::as_const(it->registerReadersAndConversions)) { for (int conversion : conversions) liveConversions[conversion].append(it->trackedRegister); } @@ -439,7 +439,7 @@ void QQmlJSBasicBlocks::adjustTypes() } for (auto it = m_readerLocations.begin(), end = m_readerLocations.end(); it != end; ++it) { - for (const QList<int> &conversions : qAsConst(it->registerReadersAndConversions)) { + for (const QList<int> &conversions : std::as_const(it->registerReadersAndConversions)) { for (int conversion : conversions) liveConversions[conversion].append(it->trackedRegister); } diff --git a/src/qmlcompiler/qqmljscodegenerator.cpp b/src/qmlcompiler/qqmljscodegenerator.cpp index 65479ed9e5..e288050f5c 100644 --- a/src/qmlcompiler/qqmljscodegenerator.cpp +++ b/src/qmlcompiler/qqmljscodegenerator.cpp @@ -204,7 +204,7 @@ QT_WARNING_POP result.code += m_body; - for (const QQmlJSRegisterContent &argType : qAsConst(function->argumentTypes)) { + for (const QQmlJSRegisterContent &argType : std::as_const(function->argumentTypes)) { if (argType.isValid()) { result.argumentTypes.append( m_typeResolver->originalType(argType.storedType()) diff --git a/src/qmlcompiler/qqmljscompiler.cpp b/src/qmlcompiler/qqmljscompiler.cpp index 60ed80823e..49c7c74040 100644 --- a/src/qmlcompiler/qqmljscompiler.cpp +++ b/src/qmlcompiler/qqmljscompiler.cpp @@ -87,7 +87,7 @@ static void annotateListElements(QmlIR::Document *document) { QStringList listElementNames; - for (const QV4::CompiledData::Import *import : qAsConst(document->imports)) { + for (const QV4::CompiledData::Import *import : std::as_const(document->imports)) { const QString uri = document->stringAt(import->uriIndex); if (uri != QStringLiteral("QtQml.Models") && uri != QStringLiteral("QtQuick")) continue; @@ -104,7 +104,7 @@ static void annotateListElements(QmlIR::Document *document) if (listElementNames.isEmpty()) return; - for (QmlIR::Object *object : qAsConst(document->objects)) { + for (QmlIR::Object *object : std::as_const(document->objects)) { if (!listElementNames.contains(document->stringAt(object->inheritedTypeNameIndex))) continue; for (QmlIR::Binding *binding = object->firstBinding(); binding; binding = binding->next) { @@ -118,7 +118,7 @@ static void annotateListElements(QmlIR::Document *document) static bool checkArgumentsObjectUseInSignalHandlers(const QmlIR::Document &doc, QQmlJSCompileError *error) { - for (QmlIR::Object *object: qAsConst(doc.objects)) { + for (QmlIR::Object *object: std::as_const(doc.objects)) { for (auto binding = object->bindingsBegin(); binding != object->bindingsEnd(); ++binding) { if (binding->type() != QV4::CompiledData::Binding::Type_Script) continue; @@ -227,7 +227,7 @@ bool qCompileQmlFile(QmlIR::Document &irDocument, const QString &inputFileName, aotCompiler->setDocument(&v4CodeGen, &irDocument); QHash<QmlIR::Object *, QmlIR::Object *> effectiveScopes; - for (QmlIR::Object *object: qAsConst(irDocument.objects)) { + for (QmlIR::Object *object: std::as_const(irDocument.objects)) { if (object->functionsAndExpressions->count == 0 && object->bindingCount() == 0) continue; diff --git a/src/qmlcompiler/qqmljsfunctioninitializer.cpp b/src/qmlcompiler/qqmljsfunctioninitializer.cpp index bb80586028..528b4c0602 100644 --- a/src/qmlcompiler/qqmljsfunctioninitializer.cpp +++ b/src/qmlcompiler/qqmljsfunctioninitializer.cpp @@ -66,7 +66,7 @@ void QQmlJSFunctionInitializer::populateSignature( arguments = ast->formals->formals(); if (function->argumentTypes.isEmpty()) { - for (const QQmlJS::AST::BoundName &argument : qAsConst(arguments)) { + for (const QQmlJS::AST::BoundName &argument : std::as_const(arguments)) { if (argument.typeAnnotation) { if (const auto type = m_typeResolver->typeFromAST(argument.typeAnnotation->type)) { function->argumentTypes.append( diff --git a/src/qmlcompiler/qqmljsimporter.cpp b/src/qmlcompiler/qqmljsimporter.cpp index 48eaa020cd..739ad70b7e 100644 --- a/src/qmlcompiler/qqmljsimporter.cpp +++ b/src/qmlcompiler/qqmljsimporter.cpp @@ -81,7 +81,7 @@ void QQmlJSImporter::readQmltypes( QQmlJS::SourceLocation() }); - for (const QString &dependency : qAsConst(dependencyStrings)) { + for (const QString &dependency : std::as_const(dependencyStrings)) { const auto blank = dependency.indexOf(u' '); if (blank < 0) { dependencies->append(QQmlDirParser::Import(dependency, {}, @@ -265,11 +265,11 @@ void QQmlJSImporter::importDependencies(const QQmlJSImporter::Import &import, { // Import the dependencies with an invalid prefix. The prefix will never be matched by actual // QML code but the C++ types will be visible. - for (auto const &dependency : qAsConst(import.dependencies)) + for (auto const &dependency : std::as_const(import.dependencies)) importHelper(dependency.module, types, QString(), dependency.version, true); bool hasOptionalImports = false; - for (auto const &import : qAsConst(import.imports)) { + for (auto const &import : std::as_const(import.imports)) { if (import.flags & QQmlDirParser::Import::Optional) { hasOptionalImports = true; if (!m_useOptionalImports) { @@ -576,7 +576,7 @@ void QQmlJSImporter::importQmldirs(const QStringList &qmldirFiles) m_seenQmldirFiles.insert(qmldirName, result); - for (const auto &object : qAsConst(result.objects)) { + for (const auto &object : std::as_const(result.objects)) { for (const auto &ex : object.exports) { m_seenImports.insert({ex.package(), ex.version()}, qmldirName); // We also have to handle the case that no version is provided diff --git a/src/qmlcompiler/qqmljsimportvisitor.cpp b/src/qmlcompiler/qqmljsimportvisitor.cpp index 2439bbaf33..6f2a8ee265 100644 --- a/src/qmlcompiler/qqmljsimportvisitor.cpp +++ b/src/qmlcompiler/qqmljsimportvisitor.cpp @@ -618,7 +618,7 @@ void QQmlJSImportVisitor::processPropertyBindingObjects() // literal bindings must already be added at this point. QSet<QPair<QQmlJSScope::Ptr, QString>> visited; for (const PendingPropertyObjectBinding &objectBinding : - qAsConst(m_pendingPropertyObjectBindings)) { + std::as_const(m_pendingPropertyObjectBindings)) { // unique because it's per-scope and per-property const auto uniqueBindingId = qMakePair(objectBinding.scope, objectBinding.name); if (visited.contains(uniqueBindingId)) @@ -640,7 +640,7 @@ void QQmlJSImportVisitor::processPropertyBindingObjects() QSet<QPair<QQmlJSScope::Ptr, QString>> foundValueSources; for (const PendingPropertyObjectBinding &objectBinding : - qAsConst(m_pendingPropertyObjectBindings)) { + std::as_const(m_pendingPropertyObjectBindings)) { const QString propertyName = objectBinding.name; QQmlJSScope::ConstPtr childScope = objectBinding.childScope; @@ -1043,7 +1043,7 @@ void QQmlJSImportVisitor::breakInheritanceCycles(const QQmlJSScope::Ptr &origina for (QQmlJSScope::ConstPtr scope = originalScope; scope;) { if (scopes.contains(scope)) { QString inheritenceCycle; - for (const auto &seen : qAsConst(scopes)) { + for (const auto &seen : std::as_const(scopes)) { inheritenceCycle.append(seen->baseTypeName()); inheritenceCycle.append(QLatin1String(" -> ")); } diff --git a/src/qmlcompiler/qqmljsscope.cpp b/src/qmlcompiler/qqmljsscope.cpp index b263e92e54..03d47203ce 100644 --- a/src/qmlcompiler/qqmljsscope.cpp +++ b/src/qmlcompiler/qqmljsscope.cpp @@ -342,7 +342,7 @@ QQmlJSScope::ImportedScope<QQmlJSScope::ConstPtr> QQmlJSScope::findType( const QString outerTypeName = name.left(colonColon); const auto outerType = contextualTypes.constFind(outerTypeName); if (outerType != contextualTypes.constEnd()) { - for (const auto &innerType : qAsConst(outerType->scope->m_childScopes)) { + for (const auto &innerType : std::as_const(outerType->scope->m_childScopes)) { if (innerType->m_internalName == name) { if (usedTypes != nullptr) usedTypes->insert(name); diff --git a/src/qmlcompiler/qqmljsstreamwriter.cpp b/src/qmlcompiler/qqmljsstreamwriter.cpp index 093d15dbd4..e435b8df92 100644 --- a/src/qmlcompiler/qqmljsstreamwriter.cpp +++ b/src/qmlcompiler/qqmljsstreamwriter.cpp @@ -161,7 +161,7 @@ void QQmlJSStreamWriter::flushPotentialLinesWithNewlines() { if (m_maybeOneline) m_stream->write("\n"); - for (const QByteArray &line : qAsConst(m_pendingLines)) { + for (const QByteArray &line : std::as_const(m_pendingLines)) { writeIndent(); m_stream->write(line); m_stream->write("\n"); diff --git a/src/qmlcompiler/qqmljsutils.cpp b/src/qmlcompiler/qqmljsutils.cpp index 33c30ccca9..8ef11444d7 100644 --- a/src/qmlcompiler/qqmljsutils.cpp +++ b/src/qmlcompiler/qqmljsutils.cpp @@ -53,7 +53,7 @@ resolveAlias(ScopeForId scopeForId, const QQmlJSMetaProperty &property, result.owner = resultOwner; result.kind = QQmlJSUtils::AliasTarget_Object; - for (const QString &bit : qAsConst(aliasExprBits)) { + for (const QString &bit : std::as_const(aliasExprBits)) { nextProperty = resultOwner->property(bit); if (!nextProperty.isValid()) return {}; diff --git a/src/qmldom/qqmldompath.cpp b/src/qmldom/qqmldompath.cpp index 4554a7cb40..2af5f3739b 100644 --- a/src/qmldom/qqmldompath.cpp +++ b/src/qmldom/qqmldompath.cpp @@ -183,7 +183,7 @@ const PathEls::PathComponent &Path::component(int i) const while (data) { i += data->components.size(); if (i >= 0) - return qAsConst(data)->components[i]; + return std::as_const(data)->components[i]; data = data->parent.get(); } Q_ASSERT(false && "Invalid data reached while resolving a seemengly valid index in Path (inconsisten Path object)"); diff --git a/src/qmldom/qqmldomtop.cpp b/src/qmldom/qqmldomtop.cpp index 61ecbb4957..0e263a0859 100644 --- a/src/qmldom/qqmldomtop.cpp +++ b/src/qmldom/qqmldomtop.cpp @@ -2158,7 +2158,7 @@ void DomEnvironment::loadPendingDependencies(DomItem &self) m_allLoadedCallback.clear(); } } - for (const Callback &cb : qAsConst(endCallbacks)) + for (const Callback &cb : std::as_const(endCallbacks)) cb(self.canonicalPath(), self, self); }); DomItem loadInfoObj = self.copy(loadInfo); diff --git a/src/qmldom/qqmldomtypesreader.cpp b/src/qmldom/qqmldomtypesreader.cpp index f6c8eecdc4..5dd486a41d 100644 --- a/src/qmldom/qqmldomtypesreader.cpp +++ b/src/qmldom/qqmldomtypesreader.cpp @@ -248,7 +248,7 @@ bool QmltypesReader::parse() QStringList dependencies; QHash<QString, QQmlJSExportedScope> objects; m_isValid = reader(&objects, &dependencies); - for (const auto &obj : qAsConst(objects)) + for (const auto &obj : std::as_const(objects)) insertComponent(obj.scope, obj.exports); qmltypesFilePtr()->setIsValid(m_isValid); return m_isValid; diff --git a/src/qmlmodels/qqmladaptormodel.cpp b/src/qmlmodels/qqmladaptormodel.cpp index 3be2474987..1687adb284 100644 --- a/src/qmlmodels/qqmladaptormodel.cpp +++ b/src/qmlmodels/qqmladaptormodel.cpp @@ -129,7 +129,7 @@ public: for (const auto item : items) guardedItems.append(item); - for (const auto &item : qAsConst(guardedItems)) { + for (const auto &item : std::as_const(guardedItems)) { if (item.isNull()) continue; diff --git a/src/qmlmodels/qqmldelegatemodel.cpp b/src/qmlmodels/qqmldelegatemodel.cpp index e3b4adce7b..46d8dbe14c 100644 --- a/src/qmlmodels/qqmldelegatemodel.cpp +++ b/src/qmlmodels/qqmldelegatemodel.cpp @@ -230,7 +230,7 @@ QQmlDelegateModel::~QQmlDelegateModel() d->disconnectFromAbstractItemModel(); d->m_adaptorModel.setObject(nullptr); - for (QQmlDelegateModelItem *cacheItem : qAsConst(d->m_cache)) { + for (QQmlDelegateModelItem *cacheItem : std::as_const(d->m_cache)) { if (cacheItem->object) { delete cacheItem->object; @@ -836,7 +836,7 @@ void QQmlDelegateModelPrivate::updateFilterGroup() if (m_parts) { auto partsCopy = m_parts->models; // deliberate; this may alter m_parts - for (QQmlPartsModel *model : qAsConst(partsCopy)) + for (QQmlPartsModel *model : std::as_const(partsCopy)) model->updateFilterGroup(m_compositorGroup, changeSet); } } @@ -1834,7 +1834,7 @@ void QQmlDelegateModelPrivate::emitChanges() QQmlDelegateModelGroupPrivate::get(m_groups[i])->emitModelUpdated(reset); auto cacheCopy = m_cache; // deliberate; emitChanges may alter m_cache - for (QQmlDelegateModelItem *cacheItem : qAsConst(cacheCopy)) { + for (QQmlDelegateModelItem *cacheItem : std::as_const(cacheCopy)) { if (cacheItem->attached) cacheItem->attached->emitChanges(); } diff --git a/src/qmlmodels/qqmltreemodeltotablemodel.cpp b/src/qmlmodels/qqmltreemodeltotablemodel.cpp index 0bc6239014..1fdcc1f95b 100644 --- a/src/qmlmodels/qqmltreemodeltotablemodel.cpp +++ b/src/qmlmodels/qqmltreemodeltotablemodel.cpp @@ -315,7 +315,7 @@ QItemSelection QQmlTreeModelToTableModel::selectionForRowRange(const QModelInde QItemSelection sel; sel.reserve(ranges.size()); - for (const MIPair &pair : qAsConst(ranges)) + for (const MIPair &pair : std::as_const(ranges)) sel.append(QItemSelectionRange(pair.first, pair.second)); return sel; @@ -1082,7 +1082,7 @@ void QQmlTreeModelToTableModel::emitQueuedSignals() * We don't merge adjacent updates, because they are typically filed with a * different role (a parent row is next to its children). */ - for (const DataChangedParams &dataChange : qAsConst(m_queuedDataChanged)) { + for (const DataChangedParams &dataChange : std::as_const(m_queuedDataChanged)) { int startRow = dataChange.topLeft.row(); int endRow = dataChange.bottomRight.row(); bool merged = false; diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index 766c633326..9ecaa42f14 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -541,15 +541,15 @@ int quick_test_main_with_setup(int argc, char **argv, const char *name, const ch // Scan through all of the "tst_*.qml" files and run each of them // in turn with a separate QQuickView (for test isolation). - for (const QString &file : qAsConst(files)) { + for (const QString &file : std::as_const(files)) { const QFileInfo fi(file); if (!fi.exists()) continue; QQmlEngine engine; - for (const QString &path : qAsConst(imports)) + for (const QString &path : std::as_const(imports)) engine.addImportPath(path); - for (const QString &path : qAsConst(pluginPaths)) + for (const QString &path : std::as_const(pluginPaths)) engine.addPluginPath(path); if (!fileSelectors.isEmpty()) { @@ -654,7 +654,7 @@ int quick_test_main_with_setup(int argc, char **argv, const char *name, const ch // Check that all test functions passed on the command line were found if (!commandLineTestFunctions.isEmpty()) { qWarning() << "Could not find the following test functions:"; - for (const QString &functionName : qAsConst(commandLineTestFunctions)) + for (const QString &functionName : std::as_const(commandLineTestFunctions)) qWarning(" %s()", qUtf8Printable(functionName)); return commandLineTestFunctions.size(); } diff --git a/src/quick/designer/qquickdesignersupportitems.cpp b/src/quick/designer/qquickdesignersupportitems.cpp index 2ee8984ea1..5887ff951f 100644 --- a/src/quick/designer/qquickdesignersupportitems.cpp +++ b/src/quick/designer/qquickdesignersupportitems.cpp @@ -118,7 +118,7 @@ void QQuickDesignerSupportItems::tweakObjects(QObject *object) { QObjectList objectList; allSubObjects(object, objectList); - for (QObject* childObject : qAsConst(objectList)) { + for (QObject* childObject : std::as_const(objectList)) { stopAnimation(childObject); makeLoaderSynchronous(childObject); if (fixResourcePathsForObjectCallBack) diff --git a/src/quick/handlers/qquickmultipointhandler.cpp b/src/quick/handlers/qquickmultipointhandler.cpp index 5fc4abe20c..1ef76148c5 100644 --- a/src/quick/handlers/qquickmultipointhandler.cpp +++ b/src/quick/handlers/qquickmultipointhandler.cpp @@ -265,7 +265,7 @@ bool QQuickMultiPointHandler::hasCurrentPoints(QPointerEvent *event) return false; // TODO optimize: either ensure the points are sorted, // or use std::equal with a predicate - for (const QQuickHandlerPoint &p : qAsConst(d->currentPoints)) { + for (const QQuickHandlerPoint &p : std::as_const(d->currentPoints)) { const QEventPoint *ep = event->pointById(p.id()); if (!ep) return false; @@ -362,7 +362,7 @@ bool QQuickMultiPointHandler::grabPoints(QPointerEvent *event, const QVector<QEv } } if (allowed) { - for (const auto &point : qAsConst(points)) + for (const auto &point : std::as_const(points)) setExclusiveGrab(event, point); } return allowed; diff --git a/src/quick/items/context2d/qquickcontext2dtexture.cpp b/src/quick/items/context2d/qquickcontext2dtexture.cpp index 0dd95a9095..2dadae3ef7 100644 --- a/src/quick/items/context2d/qquickcontext2dtexture.cpp +++ b/src/quick/items/context2d/qquickcontext2dtexture.cpp @@ -113,7 +113,7 @@ bool QQuickContext2DTexture::setDirtyRect(const QRect &r) { bool doDirty = false; if (m_tiledCanvas) { - for (QQuickContext2DTile* t : qAsConst(m_tiles)) { + for (QQuickContext2DTile* t : std::as_const(m_tiles)) { bool dirty = t->rect().intersected(r).isValid(); t->markDirty(dirty); if (dirty) @@ -197,7 +197,7 @@ void QQuickContext2DTexture::paint(QQuickContext2DCommandBuffer *ccb) QRect tiledRegion = createTiles(m_canvasWindow.intersected(QRect(QPoint(0, 0), m_canvasSize))); if (!tiledRegion.isEmpty()) { QRect dirtyRect; - for (QQuickContext2DTile* tile : qAsConst(m_tiles)) { + for (QQuickContext2DTile* tile : std::as_const(m_tiles)) { if (tile->dirty()) { if (dirtyRect.isEmpty()) dirtyRect = tile->rect(); @@ -208,7 +208,7 @@ void QQuickContext2DTexture::paint(QQuickContext2DCommandBuffer *ccb) if (beginPainting()) { QQuickContext2D::State oldState = m_state; - for (QQuickContext2DTile* tile : qAsConst(m_tiles)) { + for (QQuickContext2DTile* tile : std::as_const(m_tiles)) { if (tile->dirty()) { ccb->replay(tile->createPainter(m_smooth, m_antialiasing), oldState, scaleFactor()); tile->drawFinished(); diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp index 153931c0ed..7f45d45708 100644 --- a/src/quick/items/qquickgridview.cpp +++ b/src/quick/items/qquickgridview.cpp @@ -2066,7 +2066,7 @@ void QQuickGridView::viewportMoved(Qt::Orientations orient) // Set visibility of items to eliminate cost of items outside the visible area. qreal from = d->isContentFlowReversed() ? -d->position()-d->displayMarginBeginning-d->size() : d->position()-d->displayMarginBeginning; qreal to = d->isContentFlowReversed() ? -d->position()+d->displayMarginEnd : d->position()+d->size()+d->displayMarginEnd; - for (FxViewItem *item : qAsConst(d->visibleItems)) { + for (FxViewItem *item : std::as_const(d->visibleItems)) { FxGridItemSG *gridItem = static_cast<FxGridItemSG*>(item); QQuickItemPrivate::get(gridItem->item)->setCulled(gridItem->rowPos() + d->rowSize() < from || gridItem->rowPos() > to); } @@ -2372,7 +2372,7 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch if (modelIndex <= visibleIndex) { // Insert before visible items visibleIndex += count; - for (FxViewItem *item : qAsConst(visibleItems)) { + for (FxViewItem *item : std::as_const(visibleItems)) { if (item->index != -1 && item->index >= modelIndex) item->index += count; } @@ -2405,7 +2405,7 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch } // Update the indexes of the following visible items. - for (FxViewItem *item : qAsConst(visibleItems)) { + for (FxViewItem *item : std::as_const(visibleItems)) { if (item->index != -1 && item->index >= modelIndex) { item->index += count; if (change.isMove()) diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 7a90b62e81..966828ab51 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -3374,7 +3374,7 @@ void QQuickItemPrivate::resources_clear(QQmlListProperty<QObject> *prop) QQuickItem *quickItem = static_cast<QQuickItem *>(prop->object); QQuickItemPrivate *quickItemPrivate = QQuickItemPrivate::get(quickItem); if (quickItemPrivate->extra.isAllocated()) {//If extra is not allocated resources is empty. - for (QObject *object : qAsConst(quickItemPrivate->extra->resourcesList)) { + for (QObject *object : std::as_const(quickItemPrivate->extra->resourcesList)) { qmlobject_disconnect(object, QObject, SIGNAL(destroyed(QObject*)), quickItem, QQuickItem, SLOT(_q_resourceObjectDeleted(QObject*))); } @@ -7895,7 +7895,7 @@ void QQuickItemPrivate::setHasCursorInChild(bool hc) if (!hc && subtreeCursorEnabled) { if (hasCursor) return; // nope! sorry, I have a cursor myself - for (QQuickItem *otherChild : qAsConst(childItems)) { + for (QQuickItem *otherChild : std::as_const(childItems)) { QQuickItemPrivate *otherChildPrivate = QQuickItemPrivate::get(otherChild); if (otherChildPrivate->subtreeCursorEnabled || otherChildPrivate->hasCursor) return; // nope! sorry, something else wants it kept on. @@ -7925,7 +7925,7 @@ void QQuickItemPrivate::setHasHoverInChild(bool hasHover) if (hasEnabledHoverHandlers()) return; // nope! sorry, this item has enabled HoverHandlers - for (QQuickItem *otherChild : qAsConst(childItems)) { + for (QQuickItem *otherChild : std::as_const(childItems)) { QQuickItemPrivate *otherChildPrivate = QQuickItemPrivate::get(otherChild); if (otherChildPrivate->subtreeHoverEnabled || otherChildPrivate->hoverEnabled) return; // nope! sorry, something else wants it kept on. @@ -8792,18 +8792,18 @@ bool QQuickItem::event(QEvent *ev) #endif // gestures case QEvent::LanguageChange: case QEvent::LocaleChange: - for (QQuickItem *item : qAsConst(d->childItems)) + for (QQuickItem *item : std::as_const(d->childItems)) QCoreApplication::sendEvent(item, ev); break; case QEvent::WindowActivate: case QEvent::WindowDeactivate: if (d->providesPalette()) d->setCurrentColorGroup(); - for (QQuickItem *item : qAsConst(d->childItems)) + for (QQuickItem *item : std::as_const(d->childItems)) QCoreApplication::sendEvent(item, ev); break; case QEvent::ApplicationPaletteChange: - for (QQuickItem *item : qAsConst(d->childItems)) + for (QQuickItem *item : std::as_const(d->childItems)) QCoreApplication::sendEvent(item, ev); break; default: @@ -9683,7 +9683,7 @@ void QV4::Heap::QQuickItemWrapper::markObjects(QV4::Heap::Base *that, QV4::MarkS { QObjectWrapper *This = static_cast<QObjectWrapper *>(that); if (QQuickItem *item = static_cast<QQuickItem*>(This->object())) { - for (QQuickItem *child : qAsConst(QQuickItemPrivate::get(item)->childItems)) + for (QQuickItem *child : std::as_const(QQuickItemPrivate::get(item)->childItems)) QV4::QObjectWrapper::markWrapper(child, markStack); } QObjectWrapper::markObjects(that, markStack); diff --git a/src/quick/items/qquickitemgrabresult.cpp b/src/quick/items/qquickitemgrabresult.cpp index e14a4c25dd..01b64a7732 100644 --- a/src/quick/items/qquickitemgrabresult.cpp +++ b/src/quick/items/qquickitemgrabresult.cpp @@ -187,7 +187,7 @@ bool QQuickItemGrabResult::saveToFile(const QUrl &filePath) const */ bool QQuickItemGrabResult::saveToFile(const QString &fileName) { - return qAsConst(*this).saveToFile(fileName); + return std::as_const(*this).saveToFile(fileName); } #endif #endif // < Qt 6 diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index 33c2f0f917..5af99507fd 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -1682,7 +1682,7 @@ void QQuickItemViewPrivate::clear(bool onDestruction) releaseVisibleItems(QQmlInstanceModel::NotReusable); visibleIndex = 0; - for (FxViewItem *item : qAsConst(releasePendingTransition)) { + for (FxViewItem *item : std::as_const(releasePendingTransition)) { item->releaseAfterTransition = false; releaseItem(item, QQmlInstanceModel::NotReusable); } @@ -1866,7 +1866,7 @@ void QQuickItemViewPrivate::layout() // Give the view one more chance to refill itself, // in case its size is changed such that more delegates become visible after component completed refill(); - for (FxViewItem *item : qAsConst(visibleItems)) { + for (FxViewItem *item : std::as_const(visibleItems)) { if (!item->transitionScheduledOrRunning()) item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::PopulateTransition, true); } @@ -2034,7 +2034,7 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult } itemCount += insertions[i].count; } - for (FxViewItem *item : qAsConst(newItems)) { + for (FxViewItem *item : std::as_const(newItems)) { if (item->attached) item->attached->emitAdd(); } @@ -2043,7 +2043,7 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult // find the index it was moved from in order to set its initial position, so that we // can transition it from this "original" position to its new position in the view if (transitioner && transitioner->canTransition(QQuickItemViewTransitioner::MoveTransition, true)) { - for (const MovedItem &m : qAsConst(movingIntoView)) { + for (const MovedItem &m : std::as_const(movingIntoView)) { int fromIndex = findMoveKeyIndex(m.moveKey, removals); if (fromIndex >= 0) { if (prevFirstItemInViewIndex >= 0 && fromIndex < prevFirstItemInViewIndex) diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 5bf791977d..293d8acc7c 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -593,7 +593,7 @@ FxViewItem *QQuickListViewPrivate::snapItemAt(qreal pos) FxViewItem *snapItem = nullptr; FxViewItem *prevItem = nullptr; qreal prevItemSize = 0; - for (FxViewItem *item : qAsConst(visibleItems)) { + for (FxViewItem *item : std::as_const(visibleItems)) { if (item->index == -1) continue; @@ -1114,7 +1114,7 @@ void QQuickListViewPrivate::releaseSectionItem(QQuickItem *item) void QQuickListViewPrivate::releaseSectionItems() { - for (FxViewItem *item : qAsConst(visibleItems)) { + for (FxViewItem *item : std::as_const(visibleItems)) { FxListItemSG *listItem = static_cast<FxListItemSG *>(item); if (listItem->section()) { qreal pos = listItem->position(); @@ -1274,7 +1274,7 @@ void QQuickListViewPrivate::updateSections() QQuickListViewAttached *prevAtt = nullptr; int prevIdx = -1; int idx = -1; - for (FxViewItem *item : qAsConst(visibleItems)) { + for (FxViewItem *item : std::as_const(visibleItems)) { QQuickListViewAttached *attached = static_cast<QQuickListViewAttached*>(item->attached); attached->setPrevSection(prevSection); if (item->index != -1) { @@ -1399,7 +1399,7 @@ void QQuickListViewPrivate::updateAverage() if (!visibleItems.size()) return; qreal sum = 0.0; - for (FxViewItem *item : qAsConst(visibleItems)) + for (FxViewItem *item : std::as_const(visibleItems)) sum += item->size(); averageSize = qRound(sum / visibleItems.size()); } @@ -3385,7 +3385,7 @@ void QQuickListView::viewportMoved(Qt::Orientations orient) // Set visibility of items to eliminate cost of items outside the visible area. qreal from = d->isContentFlowReversed() ? -d->position()-d->displayMarginBeginning-d->size() : d->position()-d->displayMarginBeginning; qreal to = d->isContentFlowReversed() ? -d->position()+d->displayMarginEnd : d->position()+d->size()+d->displayMarginEnd; - for (FxViewItem *item : qAsConst(d->visibleItems)) { + for (FxViewItem *item : std::as_const(d->visibleItems)) { if (item->item) QQuickItemPrivate::get(item->item)->setCulled(item->endPosition() < from || item->position() > to); } @@ -3628,7 +3628,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch if (modelIndex < visibleIndex) { // Insert before visible items visibleIndex += count; - for (FxViewItem *item : qAsConst(visibleItems)) { + for (FxViewItem *item : std::as_const(visibleItems)) { if (item->index != -1 && item->index >= modelIndex) item->index += count; } @@ -3645,7 +3645,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch } // Update the indexes of the following visible items. - for (FxViewItem *item : qAsConst(visibleItems)) { + for (FxViewItem *item : std::as_const(visibleItems)) { if (item->index != -1 && item->index >= modelIndex) { item->index += count; if (change.isMove()) diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp index 3686553d5e..fc994fd18c 100644 --- a/src/quick/items/qquickmultipointtoucharea.cpp +++ b/src/quick/items/qquickmultipointtoucharea.cpp @@ -419,7 +419,7 @@ QQuickMultiPointTouchArea::QQuickMultiPointTouchArea(QQuickItem *parent) QQuickMultiPointTouchArea::~QQuickMultiPointTouchArea() { clearTouchLists(); - for (QObject *obj : qAsConst(_touchPoints)) { + for (QObject *obj : std::as_const(_touchPoints)) { QQuickTouchPoint *dtp = static_cast<QQuickTouchPoint*>(obj); if (!dtp->isQmlDefined()) delete dtp; @@ -580,7 +580,7 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event, RemapEventPoints int numTouchPoints = touchPoints.size(); //always remove released touches, and make sure we handle all releases before adds. - for (const QEventPoint &p : qAsConst(touchPoints)) { + for (const QEventPoint &p : std::as_const(touchPoints)) { QEventPoint::State touchPointState = p.state(); int id = p.id(); if (touchPointState & QEventPoint::State::Released) { @@ -625,7 +625,7 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event, RemapEventPoints if (!_stealMouse /* !ignoring gesture*/) { bool offerGrab = false; const int dragThreshold = QGuiApplication::styleHints()->startDragDistance(); - for (const QEventPoint &p : qAsConst(touchPoints)) { + for (const QEventPoint &p : std::as_const(touchPoints)) { if (p.state() == QEventPoint::State::Released) continue; const QPointF ¤tPos = p.scenePosition(); @@ -659,7 +659,7 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event, RemapEventPoints void QQuickMultiPointTouchArea::clearTouchLists() { - for (QObject *obj : qAsConst(_releasedTouchPoints)) { + for (QObject *obj : std::as_const(_releasedTouchPoints)) { QQuickTouchPoint *dtp = static_cast<QQuickTouchPoint*>(obj); if (!dtp->isQmlDefined()) { _touchPoints.remove(dtp->pointId()); @@ -676,7 +676,7 @@ void QQuickMultiPointTouchArea::clearTouchLists() void QQuickMultiPointTouchArea::addTouchPoint(const QEventPoint *p) { QQuickTouchPoint *dtp = nullptr; - for (QQuickTouchPoint* tp : qAsConst(_touchPrototypes)) { + for (QQuickTouchPoint* tp : std::as_const(_touchPrototypes)) { if (!tp->inUse()) { tp->setInUse(true); dtp = tp; @@ -696,7 +696,7 @@ void QQuickMultiPointTouchArea::addTouchPoint(const QEventPoint *p) void QQuickMultiPointTouchArea::addTouchPoint(const QMouseEvent *e) { QQuickTouchPoint *dtp = nullptr; - for (QQuickTouchPoint *tp : qAsConst(_touchPrototypes)) { + for (QQuickTouchPoint *tp : std::as_const(_touchPrototypes)) { if (!tp->inUse()) { tp->setInUse(true); dtp = tp; @@ -845,12 +845,12 @@ void QQuickMultiPointTouchArea::ungrab(bool normalRelease) ungrabTouchPoints(); if (_touchPoints.size()) { - for (QObject *obj : qAsConst(_touchPoints)) + for (QObject *obj : std::as_const(_touchPoints)) static_cast<QQuickTouchPoint*>(obj)->setPressed(false); if (!normalRelease) emit canceled(_touchPoints.values()); clearTouchLists(); - for (QObject *obj : qAsConst(_touchPoints)) { + for (QObject *obj : std::as_const(_touchPoints)) { QQuickTouchPoint *dtp = static_cast<QQuickTouchPoint*>(obj); if (!dtp->isQmlDefined()) delete dtp; diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index ba20c5ebdd..3e30f410f0 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -210,10 +210,10 @@ void QQuickPathViewPrivate::clear() currentItem = nullptr; } - for (QQuickItem *p : qAsConst(items)) + for (QQuickItem *p : std::as_const(items)) releaseItem(p); - for (QQuickItem *p : qAsConst(itemCache)) + for (QQuickItem *p : std::as_const(itemCache)) releaseItem(p); if (requestedIndex >= 0) { @@ -386,7 +386,7 @@ void QQuickPathViewPrivate::setHighlightPosition(qreal pos) void QQuickPathView::pathUpdated() { Q_D(QQuickPathView); - for (QQuickItem *item : qAsConst(d->items)) { + for (QQuickItem *item : std::as_const(d->items)) { if (QQuickPathViewAttached *att = d->attached(item)) att->m_percent = -1; } @@ -1989,7 +1989,7 @@ void QQuickPathView::refill() endPos = -1; startPos = 2; - for (QQuickItem * item : qAsConst(d->items)) { + for (QQuickItem * item : std::as_const(d->items)) { int idx = d->model->indexOf(item, nullptr); qreal curPos = d->positionOfIndex(idx); if (curPos > endPos) { @@ -2149,7 +2149,7 @@ void QQuickPathView::refill() if (QQuickPathViewAttached *att = d->attached(d->highlightItem)) att->setOnPath(currentVisible); } - for (QQuickItem *item : qAsConst(d->itemCache)) + for (QQuickItem *item : std::as_const(d->itemCache)) d->releaseItem(item); d->itemCache.clear(); @@ -2235,7 +2235,7 @@ void QQuickPathView::modelUpdated(const QQmlChangeSet &changeSet, bool reset) d->items.clear(); if (!d->modelCount) { - for (QQuickItem * item : qAsConst(d->itemCache)) + for (QQuickItem * item : std::as_const(d->itemCache)) d->releaseItem(item); d->itemCache.clear(); d->offset = 0; @@ -2305,7 +2305,7 @@ void QQuickPathViewPrivate::createCurrentItem() return; bool inItems = false; - for (QQuickItem *item : qAsConst(items)) { + for (QQuickItem *item : std::as_const(items)) { if (model->indexOf(item, nullptr) == currentIndex) { inItems = true; break; diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp index 997ec17f4e..2c892a596c 100644 --- a/src/quick/items/qquickrepeater.cpp +++ b/src/quick/items/qquickrepeater.cpp @@ -336,7 +336,7 @@ void QQuickRepeater::clear() d->model->release(item); } } - for (QQuickItem *item : qAsConst(d->deletables)) { + for (QQuickItem *item : std::as_const(d->deletables)) { if (item) item->setParentItem(nullptr); } diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp index c383354030..917a1257a4 100644 --- a/src/quick/items/qquickshadereffect.cpp +++ b/src/quick/items/qquickshadereffect.cpp @@ -1221,7 +1221,7 @@ void QQuickShaderEffectImpl::handleItemChange(QQuickItem::ItemChange change, con // Move the window ref. if (change == QQuickItem::ItemSceneChange) { for (int shaderType = 0; shaderType < NShader; ++shaderType) { - for (const auto &vd : qAsConst(m_shaders[shaderType].varData)) { + for (const auto &vd : std::as_const(m_shaders[shaderType].varData)) { if (vd.specialType == QSGShaderEffectNode::VariableData::Source) { QQuickItem *source = qobject_cast<QQuickItem *>(qvariant_cast<QObject *>(vd.value)); if (source) { @@ -1263,7 +1263,7 @@ void QQuickShaderEffectImpl::disconnectSignals(Shader shaderType) if (mapper) QObjectPrivate::disconnect(m_item, mapper->signalIndex(), &a); } - for (const auto &vd : qAsConst(m_shaders[shaderType].varData)) { + for (const auto &vd : std::as_const(m_shaders[shaderType].varData)) { if (vd.specialType == QSGShaderEffectNode::VariableData::Source) { QQuickItem *source = qobject_cast<QQuickItem *>(qvariant_cast<QObject *>(vd.value)); if (source) { @@ -1277,7 +1277,7 @@ void QQuickShaderEffectImpl::disconnectSignals(Shader shaderType) void QQuickShaderEffectImpl::clearMappers(QQuickShaderEffectImpl::Shader shaderType) { - for (auto *mapper : qAsConst(m_mappers[shaderType])) { + for (auto *mapper : std::as_const(m_mappers[shaderType])) { if (mapper) mapper->destroyIfLastRef(); } diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp index 1ae000c695..fe3cb1f247 100644 --- a/src/quick/items/qquickspriteengine.cpp +++ b/src/quick/items/qquickspriteengine.cpp @@ -321,7 +321,7 @@ void QQuickSpriteEngine::startAssemblingImage() QList<QQuickStochasticState*> removals; - for (QQuickStochasticState* s : qAsConst(m_states)) { + for (QQuickStochasticState* s : std::as_const(m_states)) { QQuickSprite* sprite = qobject_cast<QQuickSprite*>(s); if (sprite) { m_sprites << sprite; @@ -330,7 +330,7 @@ void QQuickSpriteEngine::startAssemblingImage() qDebug() << "Error: Non-sprite in QQuickSpriteEngine"; } } - for (QQuickStochasticState* s : qAsConst(removals)) + for (QQuickStochasticState* s : std::as_const(removals)) m_states.removeAll(s); m_startedImageAssembly = true; } @@ -339,7 +339,7 @@ QImage QQuickSpriteEngine::assembledImage(int maxSize) { QQuickPixmap::Status stat = status(); if (!m_errorsPrinted && stat == QQuickPixmap::Error) { - for (QQuickSprite* s : qAsConst(m_sprites)) + for (QQuickSprite* s : std::as_const(m_sprites)) if (s->m_pix.isError()) qmlWarning(s) << s->m_pix.error(); m_errorsPrinted = true; @@ -354,7 +354,7 @@ QImage QQuickSpriteEngine::assembledImage(int maxSize) m_imageStateCount = 0; qreal pixelRatio = 1.0; - for (QQuickSprite* state : qAsConst(m_sprites)) { + for (QQuickSprite* state : std::as_const(m_sprites)) { if (state->frames() > m_maxFrames) m_maxFrames = state->frames(); @@ -414,7 +414,7 @@ QImage QQuickSpriteEngine::assembledImage(int maxSize) image.fill(0); QPainter p(&image); int y = 0; - for (QQuickSprite* state : qAsConst(m_sprites)) { + for (QQuickSprite* state : std::as_const(m_sprites)) { QImage img(state->m_pix.image()); const int frameWidth = state->m_frameWidth; const int frameHeight = state->m_frameHeight; diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp index 43c3364e21..0cebaec795 100644 --- a/src/quick/items/qquicktableview.cpp +++ b/src/quick/items/qquicktableview.cpp @@ -1760,7 +1760,7 @@ void QQuickTableViewPrivate::updateExtents() relayoutTableItems(); // Inform the sync children that they need to rebuild to stay in sync - for (auto syncChild : qAsConst(syncChildren)) { + for (auto syncChild : std::as_const(syncChildren)) { auto syncChild_d = syncChild->d_func(); syncChild_d->scheduledRebuildOptions |= RebuildOption::ViewportOnly; if (tableMovedHorizontally) @@ -4168,7 +4168,7 @@ void QQuickTableViewPrivate::syncViewportPosRecursive() } } - for (auto syncChild : qAsConst(syncChildren)) { + for (auto syncChild : std::as_const(syncChildren)) { auto syncChild_d = syncChild->d_func(); if (!syncChild_d->inSyncViewportPosRecursive) { if (syncChild_d->syncHorizontally) diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index cdaf5cf601..8a3133df58 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -285,7 +285,7 @@ void QQuickText::imageDownloadFinished() if (d->extra.isAllocated() && d->extra->nbActiveDownloads == 0) { bool needToUpdateLayout = false; - for (QQuickStyledTextImgTag *img : qAsConst(d->extra->visibleImgTags)) { + for (QQuickStyledTextImgTag *img : std::as_const(d->extra->visibleImgTags)) { if (!img->size.isValid()) { img->size = img->pix->implicitSize(); needToUpdateLayout = true; @@ -1194,7 +1194,7 @@ void QQuickTextPrivate::setLineGeometry(QTextLine &line, qreal lineWidth, qreal QList<QQuickStyledTextImgTag *> imagesInLine; if (extra.isAllocated()) { - for (QQuickStyledTextImgTag *image : qAsConst(extra->imgTags)) { + for (QQuickStyledTextImgTag *image : std::as_const(extra->imgTags)) { if (image->position >= line.textStart() && image->position < line.textStart() + line.textLength()) { @@ -1232,7 +1232,7 @@ void QQuickTextPrivate::setLineGeometry(QTextLine &line, qreal lineWidth, qreal } } - for (QQuickStyledTextImgTag *image : qAsConst(imagesInLine)) { + for (QQuickStyledTextImgTag *image : std::as_const(imagesInLine)) { totalLineHeight = qMax(totalLineHeight, textTop + image->pos.y() + image->size.height()); const int leadX = line.cursorToX(image->position); const int trailX = line.cursorToX(image->position, QTextLine::Trailing); @@ -2511,7 +2511,7 @@ QSGNode *QQuickText::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data node->addTextLayout(QPointF(dx, dy), d->elideLayout, color, d->style, styleColor, linkColor); if (d->extra.isAllocated()) { - for (QQuickStyledTextImgTag *img : qAsConst(d->extra->visibleImgTags)) { + for (QQuickStyledTextImgTag *img : std::as_const(d->extra->visibleImgTags)) { QQuickPixmap *pix = img->pix; if (pix && pix->isReady()) node->addImage(QRectF(img->pos.x() + dx, img->pos.y() + dy, pix->width(), pix->height()), pix->image()); diff --git a/src/quick/items/qquicktextdocument.cpp b/src/quick/items/qquicktextdocument.cpp index 4f585f8333..ce0efb4d2a 100644 --- a/src/quick/items/qquicktextdocument.cpp +++ b/src/quick/items/qquicktextdocument.cpp @@ -183,7 +183,7 @@ QQuickPixmap *QQuickTextDocumentWithImageResources::loadPixmap( void QQuickTextDocumentWithImageResources::clearResources() { - for (QQuickPixmap *pixmap : qAsConst(m_resources)) + for (QQuickPixmap *pixmap : std::as_const(m_resources)) pixmap->clear(this); qDeleteAll(m_resources); m_resources.clear(); diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index 88eb4c166e..b1158899bf 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -2219,7 +2219,7 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * // Having nodes spanning across frame boundaries will break the current bookkeeping mechanism. We need to prevent that. QList<int> frameBoundaries; frameBoundaries.reserve(frames.size()); - for (QTextFrame *frame : qAsConst(frames)) + for (QTextFrame *frame : std::as_const(frames)) frameBoundaries.append(frame->firstPosition()); std::sort(frameBoundaries.begin(), frameBoundaries.end()); diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 3d8115b1bc..489693201b 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -3718,7 +3718,7 @@ void QQuickWindowPrivate::runAndClearJobs(QList<QRunnable *> *jobs) jobs->clear(); renderJobMutex.unlock(); - for (QRunnable *r : qAsConst(jobList)) { + for (QRunnable *r : std::as_const(jobList)) { r->run(); delete r; } diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalrectanglenode.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalrectanglenode.cpp index 2e8ca9686e..488f622dce 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalrectanglenode.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalrectanglenode.cpp @@ -84,7 +84,7 @@ void QSGSoftwareInternalRectangleNode::setGradientStops(const QGradientStops &st { //normalize stops bool needsNormalization = false; - for (const QGradientStop &stop : qAsConst(stops)) { + for (const QGradientStop &stop : std::as_const(stops)) { if (stop.first < 0.0 || stop.first > 1.0) { needsNormalization = true; break; @@ -250,7 +250,7 @@ bool QSGSoftwareInternalRectangleNode::isOpaque() const if (m_penWidth > 0.0f && m_penColor.alpha() < 255) return false; if (m_stops.size() > 0) { - for (const QGradientStop &stop : qAsConst(m_stops)) { + for (const QGradientStop &stop : std::as_const(m_stops)) { if (stop.second.alpha() < 255) return false; } diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp index fa709deea2..d12deec9f6 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp @@ -754,7 +754,7 @@ void QSGSoftwareThreadedRenderLoop::onAnimationStarted() { startOrStopAnimationTimer(); - for (const WindowData &w : qAsConst(m_windows)) + for (const WindowData &w : std::as_const(m_windows)) w.window->requestUpdate(); } diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index d822b66729..5acabc2888 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -272,14 +272,14 @@ void ShaderManager::invalidated() void ShaderManager::clearCachedRendererData() { - for (ShaderManager::Shader *sms : qAsConst(stockShaders)) { + for (ShaderManager::Shader *sms : std::as_const(stockShaders)) { QSGMaterialShader *s = sms->programRhi.program; if (s) { QSGMaterialShaderPrivate *sd = QSGMaterialShaderPrivate::get(s); sd->clearCachedRendererData(); } } - for (ShaderManager::Shader *sms : qAsConst(rewrittenShaders)) { + for (ShaderManager::Shader *sms : std::as_const(rewrittenShaders)) { QSGMaterialShader *s = sms->programRhi.program; if (s) { QSGMaterialShaderPrivate *sd = QSGMaterialShaderPrivate::get(s); @@ -915,7 +915,7 @@ Renderer::~Renderer() qsg_wipeBatch(m_batchPool.at(i)); } - for (Node *n : qAsConst(m_nodes)) { + for (Node *n : std::as_const(m_nodes)) { if (n->type() == QSGNode::GeometryNodeType) { Element *e = n->element(); if (!e->removed) diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp index eca8a1b35a..c20a126dce 100644 --- a/src/quick/scenegraph/qsgadaptationlayer.cpp +++ b/src/quick/scenegraph/qsgadaptationlayer.cpp @@ -180,7 +180,7 @@ void QSGDistanceFieldGlyphCache::update() storeGlyphs(distanceFields); #if defined(QSG_DISTANCEFIELD_CACHE_DEBUG) - for (Texture texture : qAsConst(m_textures)) + for (Texture texture : std::as_const(m_textures)) saveTexture(texture.texture, m_referenceFont.familyName()); #endif diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp index 389aaa9b11..e21f2fbb6f 100644 --- a/src/quick/scenegraph/qsgcontextplugin.cpp +++ b/src/quick/scenegraph/qsgcontextplugin.cpp @@ -129,7 +129,7 @@ QSGAdaptationBackendData *contextFactory() qCDebug(QSG_LOG_INFO, "Loading backend %s", qUtf8Printable(requestedBackend)); // First look for a built-in adaptation. - for (QSGContextFactoryInterface *builtInBackend : qAsConst(backendData->builtIns)) { + for (QSGContextFactoryInterface *builtInBackend : std::as_const(backendData->builtIns)) { if (builtInBackend->keys().contains(requestedBackend)) { backendData->factory = builtInBackend; backendData->name = requestedBackend; diff --git a/src/quick/scenegraph/qsgrhidistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgrhidistancefieldglyphcache.cpp index f452831bfb..a68842577d 100644 --- a/src/quick/scenegraph/qsgrhidistancefieldglyphcache.cpp +++ b/src/quick/scenegraph/qsgrhidistancefieldglyphcache.cpp @@ -43,7 +43,7 @@ QSGRhiDistanceFieldGlyphCache::~QSGRhiDistanceFieldGlyphCache() delete m_areaAllocator; // should be empty, but just in case - for (QRhiTexture *t : qAsConst(m_pendingDispose)) + for (QRhiTexture *t : std::as_const(m_pendingDispose)) t->deleteLater(); } @@ -526,7 +526,7 @@ void QSGRhiDistanceFieldGlyphCache::commitResourceUpdates(QRhiResourceUpdateBatc } // now let's assume the resource updates will be committed in this frame - for (QRhiTexture *t : qAsConst(m_pendingDispose)) + for (QRhiTexture *t : std::as_const(m_pendingDispose)) t->deleteLater(); // will be deleted after the frame is submitted -> safe m_pendingDispose.clear(); diff --git a/src/quick/scenegraph/qsgrhishadereffectnode.cpp b/src/quick/scenegraph/qsgrhishadereffectnode.cpp index 8007ea3f80..213d4ace1c 100644 --- a/src/quick/scenegraph/qsgrhishadereffectnode.cpp +++ b/src/quick/scenegraph/qsgrhishadereffectnode.cpp @@ -690,7 +690,7 @@ void QSGRhiShaderEffectNode::syncMaterial(SyncData *syncData) v.bindPoint = 1; v.type = QSGGuiThreadShaderEffectManager::ShaderInfo::Sampler; defaultSD.shaderInfo.variables.append(v); - for (const QSGShaderEffectNode::VariableData &extVarData : qAsConst(syncData->fragment.shader->varData)) { + for (const QSGShaderEffectNode::VariableData &extVarData : std::as_const(syncData->fragment.shader->varData)) { if (extVarData.specialType == QSGShaderEffectNode::VariableData::Source) { vd.value = extVarData.value; break; diff --git a/src/quick/scenegraph/qsgrhitextureglyphcache.cpp b/src/quick/scenegraph/qsgrhitextureglyphcache.cpp index a118d060dc..2324db5762 100644 --- a/src/quick/scenegraph/qsgrhitextureglyphcache.cpp +++ b/src/quick/scenegraph/qsgrhitextureglyphcache.cpp @@ -30,7 +30,7 @@ QSGRhiTextureGlyphCache::~QSGRhiTextureGlyphCache() m_texture->deleteLater(); // should be empty, but just in case - for (QRhiTexture *t : qAsConst(m_pendingDispose)) + for (QRhiTexture *t : std::as_const(m_pendingDispose)) t->deleteLater(); } @@ -224,7 +224,7 @@ void QSGRhiTextureGlyphCache::commitResourceUpdates(QRhiResourceUpdateBatch *mer } // now let's assume the resource updates will be committed in this frame - for (QRhiTexture *t : qAsConst(m_pendingDispose)) + for (QRhiTexture *t : std::as_const(m_pendingDispose)) t->deleteLater(); // will be deleted after the frame is submitted -> safe m_pendingDispose.clear(); diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp index 2c3119b2f2..509026192f 100644 --- a/src/quick/util/qquickanimation.cpp +++ b/src/quick/util/qquickanimation.cpp @@ -2706,7 +2706,7 @@ QQuickStateActions QQuickPropertyAnimation::createTransitionActions(QQuickStateA } if (!successfullyCreatedDefaultProperty) { - for (const QString &errorMessage : qAsConst(errorMessages)) + for (const QString &errorMessage : std::as_const(errorMessages)) qmlWarning(this) << errorMessage; } } diff --git a/src/quick/util/qquickanimatorcontroller.cpp b/src/quick/util/qquickanimatorcontroller.cpp index ab3ea93a71..d7c25dadc1 100644 --- a/src/quick/util/qquickanimatorcontroller.cpp +++ b/src/quick/util/qquickanimatorcontroller.cpp @@ -36,7 +36,7 @@ static void qquickanimator_invalidate_jobs(QAbstractAnimationJob *job) void QQuickAnimatorController::windowNodesDestroyed() { - for (const QSharedPointer<QAbstractAnimationJob> &toStop : qAsConst(m_rootsPendingStop)) { + for (const QSharedPointer<QAbstractAnimationJob> &toStop : std::as_const(m_rootsPendingStop)) { qquickanimator_invalidate_jobs(toStop.data()); toStop->stop(); } @@ -59,14 +59,14 @@ void QQuickAnimatorController::windowNodesDestroyed() void QQuickAnimatorController::advance() { bool running = false; - for (const QSharedPointer<QAbstractAnimationJob> &job : qAsConst(m_animationRoots)) { + for (const QSharedPointer<QAbstractAnimationJob> &job : std::as_const(m_animationRoots)) { if (job->isRunning()) { running = true; break; } } - for (QQuickAnimatorJob *job : qAsConst(m_runningAnimators)) + for (QQuickAnimatorJob *job : std::as_const(m_runningAnimators)) job->commit(); if (running) @@ -85,18 +85,18 @@ static void qquickanimator_sync_before_start(QAbstractAnimationJob *job) void QQuickAnimatorController::beforeNodeSync() { - for (const QSharedPointer<QAbstractAnimationJob> &toStop : qAsConst(m_rootsPendingStop)) { + for (const QSharedPointer<QAbstractAnimationJob> &toStop : std::as_const(m_rootsPendingStop)) { toStop->stop(); m_animationRoots.remove(toStop.data()); } m_rootsPendingStop.clear(); - for (QQuickAnimatorJob *job : qAsConst(m_runningAnimators)) + for (QQuickAnimatorJob *job : std::as_const(m_runningAnimators)) job->preSync(); // Start pending jobs - for (const QSharedPointer<QAbstractAnimationJob> &job : qAsConst(m_rootsPendingStart)) { + for (const QSharedPointer<QAbstractAnimationJob> &job : std::as_const(m_rootsPendingStart)) { Q_ASSERT(!job->isRunning()); // We want to make sure that presync is called before @@ -118,7 +118,7 @@ void QQuickAnimatorController::beforeNodeSync() void QQuickAnimatorController::afterNodeSync() { - for (QQuickAnimatorJob *job : qAsConst(m_runningAnimators)) + for (QQuickAnimatorJob *job : std::as_const(m_runningAnimators)) job->postSync(); } diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp index c6cb18058f..5b6ed25692 100644 --- a/src/quick/util/qquickglobal.cpp +++ b/src/quick/util/qquickglobal.cpp @@ -99,7 +99,7 @@ void QQmlQtQuick2DebugStatesDelegate::updateBinding(QQmlContext *context, typedef QPointer<QQuickState> QuickStatePointer; QObject *object = property.object(); QString propertyName = property.name(); - for (const QuickStatePointer& statePointer : qAsConst(m_allStates)) { + for (const QuickStatePointer& statePointer : std::as_const(m_allStates)) { if (QQuickState *state = statePointer.data()) { // here we assume that the revert list on itself defines the base state if (state->isStateActive() && state->containsPropertyInRevertList(object, propertyName)) { diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp index bc65acedf0..a38de75753 100644 --- a/src/quick/util/qquickpath.cpp +++ b/src/quick/util/qquickpath.cpp @@ -413,7 +413,7 @@ QPainterPath QQuickPath::createPath(const QPointF &startPoint, const QPointF &en bool usesPercent = false; int index = 0; - for (QQuickPathElement *pathElement : qAsConst(d->_pathElements)) { + for (QQuickPathElement *pathElement : std::as_const(d->_pathElements)) { if (QQuickCurve *curve = qobject_cast<QQuickCurve *>(pathElement)) { QQuickPathData data; data.index = index; @@ -495,7 +495,7 @@ QPainterPath QQuickPath::createShapePath(const QPointF &startPoint, const QPoint path.moveTo(startX, startY); int index = 0; - for (QQuickCurve *curve : qAsConst(d->_pathCurves)) { + for (QQuickCurve *curve : std::as_const(d->_pathCurves)) { QQuickPathData data; data.index = index; data.endPoint = endPoint; @@ -504,7 +504,7 @@ QPainterPath QQuickPath::createShapePath(const QPointF &startPoint, const QPoint ++index; } - for (QQuickPathText *text : qAsConst(d->_pathTexts)) + for (QQuickPathText *text : std::as_const(d->_pathTexts)) text->addToPath(path); if (closed) { @@ -550,7 +550,7 @@ void QQuickPath::gatherAttributes() QSet<QString> attributes; // First gather up all the attributes - for (QQuickPathElement *pathElement : qAsConst(d->_pathElements)) { + for (QQuickPathElement *pathElement : std::as_const(d->_pathElements)) { if (QQuickCurve *curve = qobject_cast<QQuickCurve *>(pathElement)) d->_pathCurves.append(curve); else if (QQuickPathText *text = qobject_cast<QQuickPathText *>(pathElement)) diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 61294b3312..7644ab4447 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -499,7 +499,7 @@ QQuickPixmapReader::~QQuickPixmapReader() mutex.lock(); // manually cancel all outstanding jobs. - for (QQuickPixmapReply *reply : qAsConst(jobs)) { + for (QQuickPixmapReply *reply : std::as_const(jobs)) { if (reply->data && reply->data->reply == reply) reply->data->reply = nullptr; delete reply; @@ -514,10 +514,10 @@ QQuickPixmapReader::~QQuickPixmapReader() } }; - for (auto *reply : qAsConst(networkJobs)) + for (auto *reply : std::as_const(networkJobs)) cancelJob(reply); - for (auto *reply : qAsConst(asyncResponses)) + for (auto *reply : std::as_const(asyncResponses)) cancelJob(reply); #endif if (threadObject) threadObject->processJobs(); diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp index 1c25cc10da..fcb6e71e17 100644 --- a/src/quick/util/qquickpropertychanges.cpp +++ b/src/quick/util/qquickpropertychanges.cpp @@ -238,7 +238,7 @@ void QQuickPropertyChangesPrivate::decode() if (decoded) return; - for (const QV4::CompiledData::Binding *binding : qAsConst(bindings)) + for (const QV4::CompiledData::Binding *binding : std::as_const(bindings)) decodeBinding(QString(), compilationUnit, binding); bindings.clear(); diff --git a/src/quick/util/qquicksmoothedanimation.cpp b/src/quick/util/qquicksmoothedanimation.cpp index 5e05da302d..4681d5919e 100644 --- a/src/quick/util/qquicksmoothedanimation.cpp +++ b/src/quick/util/qquicksmoothedanimation.cpp @@ -351,7 +351,7 @@ QQuickSmoothedAnimationPrivate::~QQuickSmoothedAnimationPrivate() void QQuickSmoothedAnimationPrivate::updateRunningAnimations() { - for (QSmoothedAnimation *ease : qAsConst(activeAnimations)) { + for (QSmoothedAnimation *ease : std::as_const(activeAnimations)) { ease->maximumEasingTime = anim->maximumEasingTime; ease->reversingMode = anim->reversingMode; ease->velocity = anim->velocity; diff --git a/src/quick/util/qquickstate.cpp b/src/quick/util/qquickstate.cpp index 20f54081c6..51bc9852f4 100644 --- a/src/quick/util/qquickstate.cpp +++ b/src/quick/util/qquickstate.cpp @@ -636,7 +636,7 @@ void QQuickState::apply(QQuickTransition *trans, QQuickState *revert) d->revertList << additionalReverts; if (lcStates().isDebugEnabled()) { - for (const QQuickStateAction &action : qAsConst(applyList)) { + for (const QQuickStateAction &action : std::as_const(applyList)) { if (action.event) qCDebug(lcStates) << "QQuickStateAction event:" << action.event->type(); else diff --git a/src/quick/util/qquicktransitionmanager.cpp b/src/quick/util/qquicktransitionmanager.cpp index 1862aa0fc8..efaa01c305 100644 --- a/src/quick/util/qquicktransitionmanager.cpp +++ b/src/quick/util/qquicktransitionmanager.cpp @@ -59,7 +59,7 @@ void QQuickTransitionManager::complete() // Explicitly take a copy in case the write action triggers a script that modifies the list. QQuickTransitionManagerPrivate::SimpleActionList completeListCopy = d->completeList; - for (const QQuickSimpleAction &action : qAsConst(completeListCopy)) + for (const QQuickSimpleAction &action : std::as_const(completeListCopy)) action.property().write(action.value()); d->completeList.clear(); @@ -72,7 +72,7 @@ void QQuickTransitionManager::complete() void QQuickTransitionManagerPrivate::applyBindings() { - for (const QQuickStateAction &action : qAsConst(bindingsList)) { + for (const QQuickStateAction &action : std::as_const(bindingsList)) { if (auto binding = action.toBinding; binding) { binding.installOn(action.property, QQmlAnyBinding::RespectInterceptors); } else if (action.event) { @@ -101,7 +101,7 @@ void QQuickTransitionManager::transition(const QList<QQuickStateAction> &list, QQuickStateOperation::ActionList applyList = list; // Determine which actions are binding changes and disable any current bindings - for (const QQuickStateAction &action : qAsConst(applyList)) { + for (const QQuickStateAction &action : std::as_const(applyList)) { if (action.toBinding) d->bindingsList << action; if (action.fromBinding) { @@ -125,7 +125,7 @@ void QQuickTransitionManager::transition(const QList<QQuickStateAction> &list, if (transition && !d->bindingsList.isEmpty()) { // Apply all the property and binding changes - for (const QQuickStateAction &action : qAsConst(applyList)) { + for (const QQuickStateAction &action : std::as_const(applyList)) { if (auto binding = action.toBinding; binding) { binding.installOn(action.property); } else if (!action.event) { @@ -150,7 +150,7 @@ void QQuickTransitionManager::transition(const QList<QQuickStateAction> &list, } // Revert back to the original values - for (const QQuickStateAction &action : qAsConst(applyList)) { + for (const QQuickStateAction &action : std::as_const(applyList)) { if (action.event) { if (action.event->isReversable()) { action.event->clearBindings(); @@ -198,7 +198,7 @@ void QQuickTransitionManager::transition(const QList<QQuickStateAction> &list, // be applied immediately. We skip applying bindings, as they are all // applied at the end in applyBindings() to avoid any nastiness mid // transition - for (const QQuickStateAction &action : qAsConst(applyList)) { + for (const QQuickStateAction &action : std::as_const(applyList)) { if (action.event && !action.event->changesBindings()) { if (action.event->isReversable() && action.reverseEvent) action.event->reverse(); @@ -209,7 +209,7 @@ void QQuickTransitionManager::transition(const QList<QQuickStateAction> &list, } } if (lcStates().isDebugEnabled()) { - for (const QQuickStateAction &action : qAsConst(applyList)) { + for (const QQuickStateAction &action : std::as_const(applyList)) { if (action.event) qCDebug(lcStates) << "no transition for event:" << action.event->type(); else @@ -228,7 +228,7 @@ void QQuickTransitionManager::cancel() if (d->transitionInstance && d->transitionInstance->isRunning()) RETURN_IF_DELETED(d->transitionInstance->stop()); - for (const QQuickStateAction &action : qAsConst(d->bindingsList)) { + for (const QQuickStateAction &action : std::as_const(d->bindingsList)) { if (action.toBinding && action.deletableToBinding) { auto property = action.property; QQmlAnyBinding::removeBindingFrom(property); diff --git a/src/quickcontrols2impl/qquickimageselector.cpp b/src/quickcontrols2impl/qquickimageselector.cpp index eb13fe2c96..35f6555684 100644 --- a/src/quickcontrols2impl/qquickimageselector.cpp +++ b/src/quickcontrols2impl/qquickimageselector.cpp @@ -256,7 +256,7 @@ void QQuickImageSelector::setUrl(const QUrl &url) bool QQuickImageSelector::updateActiveStates() { QStringList active; - for (const QVariant &v : qAsConst(m_allStates)) { + for (const QVariant &v : std::as_const(m_allStates)) { const QVariantMap state = v.toMap(); if (state.isEmpty()) continue; diff --git a/src/quicklayouts/qquicklinearlayout.cpp b/src/quicklayouts/qquicklinearlayout.cpp index 569d48cf69..8cb3ecfcf1 100644 --- a/src/quicklayouts/qquicklinearlayout.cpp +++ b/src/quicklayouts/qquicklinearlayout.cpp @@ -471,7 +471,7 @@ void QQuickGridLayoutBase::rearrange(const QSizeF &size) d->engine.setGeometries(QRectF(QPointF(0,0), size), d->styleInfo); d->m_rearranging = false; - for (QQuickItem *invalid : qAsConst(d->m_invalidateAfterRearrange)) + for (QQuickItem *invalid : std::as_const(d->m_invalidateAfterRearrange)) invalidate(invalid); d->m_invalidateAfterRearrange.clear(); } diff --git a/src/quickshapes/qquickshapegenericrenderer.cpp b/src/quickshapes/qquickshapegenericrenderer.cpp index c7b7eeadb1..b91f2d59a1 100644 --- a/src/quickshapes/qquickshapegenericrenderer.cpp +++ b/src/quickshapes/qquickshapegenericrenderer.cpp @@ -355,7 +355,7 @@ void QQuickShapeGenericRenderer::endSync(bool async) void QQuickShapeGenericRenderer::maybeUpdateAsyncItem() { - for (const ShapePathData &d : qAsConst(m_sp)) { + for (const ShapePathData &d : std::as_const(m_sp)) { if (d.pendingFill || d.pendingStroke) return; } diff --git a/src/quickshapes/qquickshapesoftwarerenderer.cpp b/src/quickshapes/qquickshapesoftwarerenderer.cpp index 620b964180..20834f6179 100644 --- a/src/quickshapes/qquickshapesoftwarerenderer.cpp +++ b/src/quickshapes/qquickshapesoftwarerenderer.cpp @@ -224,7 +224,7 @@ void QQuickShapeSoftwareRenderNode::render(const RenderState *state) p->setTransform(matrix()->toTransform()); p->setOpacity(inheritedOpacity()); - for (const ShapePathRenderData &d : qAsConst(m_sp)) { + for (const ShapePathRenderData &d : std::as_const(m_sp)) { p->setPen(d.strokeWidth >= 0.0f && d.pen.color() != Qt::transparent ? d.pen : Qt::NoPen); p->setBrush(d.brush.color() != Qt::transparent ? d.brush : Qt::NoBrush); p->drawPath(d.path); diff --git a/src/quicktemplates2/qquickaction.cpp b/src/quicktemplates2/qquickaction.cpp index 2cf1006845..2ff5fd4a48 100644 --- a/src/quicktemplates2/qquickaction.cpp +++ b/src/quicktemplates2/qquickaction.cpp @@ -151,14 +151,14 @@ void QQuickActionPrivate::setShortcut(const QVariant &var) return; defaultShortcutEntry->ungrab(); - for (QQuickActionPrivate::ShortcutEntry *entry : qAsConst(shortcutEntries)) + for (QQuickActionPrivate::ShortcutEntry *entry : std::as_const(shortcutEntries)) entry->ungrab(); vshortcut = var; keySequence = variantToKeySequence(var); defaultShortcutEntry->grab(keySequence, enabled); - for (QQuickActionPrivate::ShortcutEntry *entry : qAsConst(shortcutEntries)) + for (QQuickActionPrivate::ShortcutEntry *entry : std::as_const(shortcutEntries)) entry->grab(keySequence, enabled); emit q->shortcutChanged(keySequence); @@ -175,7 +175,7 @@ void QQuickActionPrivate::setEnabled(bool enable) #if QT_CONFIG(shortcut) defaultShortcutEntry->setEnabled(enable); - for (QQuickActionPrivate::ShortcutEntry *entry : qAsConst(shortcutEntries)) + for (QQuickActionPrivate::ShortcutEntry *entry : std::as_const(shortcutEntries)) entry->setEnabled(enable); #endif @@ -288,7 +288,7 @@ QQuickActionPrivate::ShortcutEntry *QQuickActionPrivate::findShortcutEntry(QObje void QQuickActionPrivate::updateDefaultShortcutEntry() { bool hasActiveShortcutEntries = false; - for (QQuickActionPrivate::ShortcutEntry *entry : qAsConst(shortcutEntries)) { + for (QQuickActionPrivate::ShortcutEntry *entry : std::as_const(shortcutEntries)) { if (entry->shortcutId()) { hasActiveShortcutEntries = true; break; @@ -318,7 +318,7 @@ QQuickAction::~QQuickAction() d->group->removeAction(this); #if QT_CONFIG(shortcut) - for (QQuickActionPrivate::ShortcutEntry *entry : qAsConst(d->shortcutEntries)) + for (QQuickActionPrivate::ShortcutEntry *entry : std::as_const(d->shortcutEntries)) d->unwatchItem(qobject_cast<QQuickItem *>(entry->target())); qDeleteAll(d->shortcutEntries); diff --git a/src/quicktemplates2/qquickactiongroup.cpp b/src/quicktemplates2/qquickactiongroup.cpp index 72f4027341..5e088f3924 100644 --- a/src/quicktemplates2/qquickactiongroup.cpp +++ b/src/quicktemplates2/qquickactiongroup.cpp @@ -128,7 +128,7 @@ public: void QQuickActionGroupPrivate::clear() { - for (QQuickAction *action : qAsConst(actions)) { + for (QQuickAction *action : std::as_const(actions)) { QQuickActionPrivate::get(action)->group = nullptr; QObjectPrivate::disconnect(action, &QQuickAction::triggered, this, &QQuickActionGroupPrivate::actionTriggered); QObjectPrivate::disconnect(action, &QQuickAction::checkedChanged, this, &QQuickActionGroupPrivate::_q_updateCurrent); @@ -307,7 +307,7 @@ void QQuickActionGroup::setEnabled(bool enabled) if (d->enabled == enabled) return; - for (QQuickAction *action : qAsConst(d->actions)) { + for (QQuickAction *action : std::as_const(d->actions)) { if (d->changeEnabled(action, enabled)) emit action->enabledChanged(enabled); } diff --git a/src/quicktemplates2/qquickbuttongroup.cpp b/src/quicktemplates2/qquickbuttongroup.cpp index 87f3f1a05c..89a64720dc 100644 --- a/src/quicktemplates2/qquickbuttongroup.cpp +++ b/src/quicktemplates2/qquickbuttongroup.cpp @@ -142,7 +142,7 @@ public: void QQuickButtonGroupPrivate::clear() { - for (QQuickAbstractButton *button : qAsConst(buttons)) { + for (QQuickAbstractButton *button : std::as_const(buttons)) { QQuickAbstractButtonPrivate::get(button)->group = nullptr; QObjectPrivate::disconnect(button, &QQuickAbstractButton::clicked, this, &QQuickButtonGroupPrivate::buttonClicked); QObjectPrivate::disconnect(button, &QQuickAbstractButton::checkedChanged, this, &QQuickButtonGroupPrivate::_q_updateCurrent); @@ -178,7 +178,7 @@ void QQuickButtonGroupPrivate::updateCheckState() bool anyChecked = false; bool allChecked = !buttons.isEmpty(); - for (QQuickAbstractButton *button : qAsConst(buttons)) { + for (QQuickAbstractButton *button : std::as_const(buttons)) { const bool isChecked = button->isChecked(); anyChecked |= isChecked; allChecked &= isChecked; @@ -376,7 +376,7 @@ void QQuickButtonGroup::setCheckState(Qt::CheckState state) if (d->checkedButton && state == Qt::Unchecked) setCheckedButton(nullptr); } else { - for (QQuickAbstractButton *button : qAsConst(d->buttons)) + for (QQuickAbstractButton *button : std::as_const(d->buttons)) button->setChecked(state == Qt::Checked); } d->settingCheckState = false; diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp index ccaf3219b6..3b5e4afd1d 100644 --- a/src/quicktemplates2/qquickoverlay.cpp +++ b/src/quicktemplates2/qquickoverlay.cpp @@ -389,7 +389,7 @@ void QQuickOverlay::geometryChange(const QRectF &newGeometry, const QRectF &oldG { Q_D(QQuickOverlay); QQuickItem::geometryChange(newGeometry, oldGeometry); - for (QQuickPopup *popup : qAsConst(d->allPopups)) + for (QQuickPopup *popup : std::as_const(d->allPopups)) QQuickPopupPrivate::get(popup)->resizeOverlay(); } diff --git a/src/quicktemplates2/qquickstackview.cpp b/src/quicktemplates2/qquickstackview.cpp index 892f4a3e71..1b16c6e581 100644 --- a/src/quicktemplates2/qquickstackview.cpp +++ b/src/quicktemplates2/qquickstackview.cpp @@ -561,7 +561,7 @@ void QQuickStackView::push(QQmlV4Function *args) if (!errors.isEmpty() || elements.isEmpty()) { if (!errors.isEmpty()) { - for (const QString &error : qAsConst(errors)) + for (const QString &error : std::as_const(errors)) d->warn(error); } else { d->warn(QStringLiteral("nothing to push")); @@ -828,7 +828,7 @@ void QQuickStackView::replace(QQmlV4Function *args) QList<QQuickStackElement *> elements = d->parseElements(target ? 1 : 0, args, &errors); if (!errors.isEmpty() || elements.isEmpty()) { if (!errors.isEmpty()) { - for (const QString &error : qAsConst(errors)) + for (const QString &error : std::as_const(errors)) d->warn(error); } else { d->warn(QStringLiteral("nothing to push")); @@ -1135,7 +1135,7 @@ void QQuickStackView::geometryChange(const QRectF &newGeometry, const QRectF &ol QQuickControl::geometryChange(newGeometry, oldGeometry); Q_D(QQuickStackView); - for (QQuickStackElement *element : qAsConst(d->elements)) { + for (QQuickStackElement *element : std::as_const(d->elements)) { if (element->item) { if (!element->widthValid) element->item->setWidth(newGeometry.width()); diff --git a/src/quicktemplates2/qquickstackview_p.cpp b/src/quicktemplates2/qquickstackview_p.cpp index 8b0811195a..c867c55dcc 100644 --- a/src/quicktemplates2/qquickstackview_p.cpp +++ b/src/quicktemplates2/qquickstackview_p.cpp @@ -109,7 +109,7 @@ QList<QQuickStackElement *> QQuickStackViewPrivate::parseElements(int from, QQml QQuickStackElement *QQuickStackViewPrivate::findElement(QQuickItem *item) const { if (item) { - for (QQuickStackElement *e : qAsConst(elements)) { + for (QQuickStackElement *e : std::as_const(elements)) { if (e->item == item) return e; } @@ -287,7 +287,7 @@ void QQuickStackViewPrivate::viewItemTransitionFinished(QQuickItemViewTransition QList<QQuickStackElement*> removedElements = removed; removed.clear(); - for (QQuickStackElement *removedElement : qAsConst(removedElements)) { + for (QQuickStackElement *removedElement : std::as_const(removedElements)) { // If an element with the same item is found in the active stack list, // forget about the item so that we don't hide it. if (removedElement->item && findElement(removedElement->item)) { diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp index 1421f0155d..a1dfc9068c 100644 --- a/src/quicktemplates2/qquicktabbar.cpp +++ b/src/quicktemplates2/qquicktabbar.cpp @@ -147,7 +147,7 @@ void QQuickTabBarPrivate::updateLayout() const qreal itemWidth = (contentItem->width() - reservedWidth - totalSpacing) / qMax(1, resizableCount); updatingLayout = true; - for (QQuickItem *item : qAsConst(allItems)) { + for (QQuickItem *item : std::as_const(allItems)) { QQuickItemPrivate *p = QQuickItemPrivate::get(item); if (!p->widthValid()) { item->setWidth(itemWidth); diff --git a/tests/auto/particles/qquickage/tst_qquickage.cpp b/tests/auto/particles/qquickage/tst_qquickage.cpp index b0a41afb45..21b79d8921 100644 --- a/tests/auto/particles/qquickage/tst_qquickage.cpp +++ b/tests/auto/particles/qquickage/tst_qquickage.cpp @@ -35,7 +35,7 @@ void tst_qquickage::test_kill() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused @@ -60,7 +60,7 @@ void tst_qquickage::test_jump() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused @@ -86,7 +86,7 @@ void tst_qquickage::test_onceOff() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused @@ -112,7 +112,7 @@ void tst_qquickage::test_sustained() //TODO: Ensure some particles have lived to 0.4s point despite unified timer //Can't verify size, because particles never die. It will constantly grow. - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickangleddirection/tst_qquickangleddirection.cpp b/tests/auto/particles/qquickangleddirection/tst_qquickangleddirection.cpp index 63f77f3b30..8b2cb417cb 100644 --- a/tests/auto/particles/qquickangleddirection/tst_qquickangleddirection.cpp +++ b/tests/auto/particles/qquickangleddirection/tst_qquickangleddirection.cpp @@ -32,7 +32,7 @@ void tst_qquickangleddirection::test_basic() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickcumulativedirection/tst_qquickcumulativedirection.cpp b/tests/auto/particles/qquickcumulativedirection/tst_qquickcumulativedirection.cpp index 9e1a95863d..df427600c5 100644 --- a/tests/auto/particles/qquickcumulativedirection/tst_qquickcumulativedirection.cpp +++ b/tests/auto/particles/qquickcumulativedirection/tst_qquickcumulativedirection.cpp @@ -31,7 +31,7 @@ void tst_qquickcumulativedirection::test_basic() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp b/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp index c38bc1cdd8..e10885cf84 100644 --- a/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp +++ b/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp @@ -33,7 +33,7 @@ void tst_qquickcustomaffector::test_basic() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused //in CI the whole simulation often happens at once, so dead particles end up missing out @@ -66,7 +66,7 @@ void tst_qquickcustomaffector::test_move() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused if (!d->stillAlive(system)) diff --git a/tests/auto/particles/qquickellipseextruder/tst_qquickellipseextruder.cpp b/tests/auto/particles/qquickellipseextruder/tst_qquickellipseextruder.cpp index 9912e54eec..98139e8271 100644 --- a/tests/auto/particles/qquickellipseextruder/tst_qquickellipseextruder.cpp +++ b/tests/auto/particles/qquickellipseextruder/tst_qquickellipseextruder.cpp @@ -48,7 +48,7 @@ void tst_qquickellipseextruder::test_basic() //Filled QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused @@ -65,7 +65,7 @@ void tst_qquickellipseextruder::test_basic() //Just border QCOMPARE(system->groupData[1]->size(), 500); - for (QQuickParticleData *d : qAsConst(system->groupData[1]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[1]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickfriction/tst_qquickfriction.cpp b/tests/auto/particles/qquickfriction/tst_qquickfriction.cpp index 94e2b67ac2..edc3770f85 100644 --- a/tests/auto/particles/qquickfriction/tst_qquickfriction.cpp +++ b/tests/auto/particles/qquickfriction/tst_qquickfriction.cpp @@ -33,7 +33,7 @@ void tst_qquickfriction::test_basic() //Default is just slowed a little QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused @@ -50,7 +50,7 @@ void tst_qquickfriction::test_basic() //Nondefault comes to a complete stop within the first half of its life QCOMPARE(system->groupData[1]->size(), 500); - for (QQuickParticleData *d : qAsConst(system->groupData[1]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[1]->data)) { if (d->t == -1) continue; //Particle data unused @@ -77,7 +77,7 @@ void tst_qquickfriction::test_threshold() //Velocity capped at 50, but it might take a frame or two to get there QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1.0f) continue; //Particle data unused if (myFuzzyGEQ(d->t, ((qreal)system->timeInt/1000.0) - 0.1)) diff --git a/tests/auto/particles/qquickgravity/tst_qquickgravity.cpp b/tests/auto/particles/qquickgravity/tst_qquickgravity.cpp index 772eabba55..d95bb19827 100644 --- a/tests/auto/particles/qquickgravity/tst_qquickgravity.cpp +++ b/tests/auto/particles/qquickgravity/tst_qquickgravity.cpp @@ -32,7 +32,7 @@ void tst_qquickgravity::test_basic() QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); float mag = 707.10678f; - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1 || !d->stillAlive(system)) continue; //Particle data unused or dead diff --git a/tests/auto/particles/qquickgroupgoal/tst_qquickgroupgoal.cpp b/tests/auto/particles/qquickgroupgoal/tst_qquickgroupgoal.cpp index 6d91ed149c..87a0c9f21e 100644 --- a/tests/auto/particles/qquickgroupgoal/tst_qquickgroupgoal.cpp +++ b/tests/auto/particles/qquickgroupgoal/tst_qquickgroupgoal.cpp @@ -32,7 +32,7 @@ void tst_qquickgroupgoal::test_instantTransition() ensureAnimTime(600, system->m_animation); QVERIFY(system->groupData[0]->size() <= 500 && system->groupData[0]->size() >= 450); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp b/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp index 87335172ce..826314e79f 100644 --- a/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp +++ b/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp @@ -45,7 +45,7 @@ void tst_qquickimageparticle::test_basic() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused @@ -89,7 +89,7 @@ void tst_qquickimageparticle::test_colored() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused @@ -133,7 +133,7 @@ void tst_qquickimageparticle::test_colorVariance() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused @@ -178,7 +178,7 @@ void tst_qquickimageparticle::test_deformed() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused @@ -222,7 +222,7 @@ void tst_qquickimageparticle::test_tabled() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused @@ -267,7 +267,7 @@ void tst_qquickimageparticle::test_sprite() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp b/tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp index 24b87bad41..8e82f91a92 100644 --- a/tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp +++ b/tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp @@ -38,7 +38,7 @@ void tst_qquickitemparticle::test_basic() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused @@ -119,7 +119,7 @@ void tst_qquickitemparticle::test_noLeakWhenDeleted() QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); ensureAnimTime(100, system->m_animation); - auto particles = qAsConst(system->groupData[0]->data); + auto particles = std::as_const(system->groupData[0]->data); QVERIFY(!particles.isEmpty()); QQuickParticleData* firstParticleData = particles.first(); diff --git a/tests/auto/particles/qquicklineextruder/tst_qquicklineextruder.cpp b/tests/auto/particles/qquicklineextruder/tst_qquicklineextruder.cpp index 81c7462f54..98e300d90a 100644 --- a/tests/auto/particles/qquicklineextruder/tst_qquicklineextruder.cpp +++ b/tests/auto/particles/qquicklineextruder/tst_qquicklineextruder.cpp @@ -31,7 +31,7 @@ void tst_qquicklineextruder::test_basic() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused @@ -47,7 +47,7 @@ void tst_qquicklineextruder::test_basic() } QCOMPARE(system->groupData[1]->size(), 500); - for (QQuickParticleData *d : qAsConst(system->groupData[1]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[1]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickmaskextruder/tst_qquickmaskextruder.cpp b/tests/auto/particles/qquickmaskextruder/tst_qquickmaskextruder.cpp index faa3d0732a..6c4bb44a07 100644 --- a/tests/auto/particles/qquickmaskextruder/tst_qquickmaskextruder.cpp +++ b/tests/auto/particles/qquickmaskextruder/tst_qquickmaskextruder.cpp @@ -31,7 +31,7 @@ void tst_qquickmaskextruder::test_basic() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickparticlegroup/tst_qquickparticlegroup.cpp b/tests/auto/particles/qquickparticlegroup/tst_qquickparticlegroup.cpp index 0a6ba45be7..75c2e72c34 100644 --- a/tests/auto/particles/qquickparticlegroup/tst_qquickparticlegroup.cpp +++ b/tests/auto/particles/qquickparticlegroup/tst_qquickparticlegroup.cpp @@ -32,7 +32,7 @@ void tst_qquickparticlegroup::test_instantTransition() //A frame or two worth of particles will be missed, the transition doesn't take effect on the frame it's spawned (QTBUG-21781) QVERIFY(system->groupData[0]->size() <= 500 && system->groupData[0]->size() >= 450); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp b/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp index 0a22f86fc3..cadeac66f5 100644 --- a/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp +++ b/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp @@ -33,7 +33,7 @@ void tst_qquickparticlesystem::test_basic() QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); int stillAlive = 0; - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickpointattractor/tst_qquickpointattractor.cpp b/tests/auto/particles/qquickpointattractor/tst_qquickpointattractor.cpp index 04bd52bee0..e5822c1b88 100644 --- a/tests/auto/particles/qquickpointattractor/tst_qquickpointattractor.cpp +++ b/tests/auto/particles/qquickpointattractor/tst_qquickpointattractor.cpp @@ -31,7 +31,7 @@ void tst_qquickpointattractor::test_basic() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickpointdirection/tst_qquickpointdirection.cpp b/tests/auto/particles/qquickpointdirection/tst_qquickpointdirection.cpp index 441e2663b1..8c39bad812 100644 --- a/tests/auto/particles/qquickpointdirection/tst_qquickpointdirection.cpp +++ b/tests/auto/particles/qquickpointdirection/tst_qquickpointdirection.cpp @@ -31,7 +31,7 @@ void tst_qquickpointdirection::test_basic() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickrectangleextruder/tst_qquickrectangleextruder.cpp b/tests/auto/particles/qquickrectangleextruder/tst_qquickrectangleextruder.cpp index c40d57704d..99cbeba35a 100644 --- a/tests/auto/particles/qquickrectangleextruder/tst_qquickrectangleextruder.cpp +++ b/tests/auto/particles/qquickrectangleextruder/tst_qquickrectangleextruder.cpp @@ -31,7 +31,7 @@ void tst_qquickrectangleextruder::test_basic() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused @@ -50,7 +50,7 @@ void tst_qquickrectangleextruder::test_basic() } QCOMPARE(system->groupData[1]->size(), 500); - for (QQuickParticleData *d : qAsConst(system->groupData[1]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[1]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickspritegoal/tst_qquickspritegoal.cpp b/tests/auto/particles/qquickspritegoal/tst_qquickspritegoal.cpp index c349456790..4dd965aff7 100644 --- a/tests/auto/particles/qquickspritegoal/tst_qquickspritegoal.cpp +++ b/tests/auto/particles/qquickspritegoal/tst_qquickspritegoal.cpp @@ -31,7 +31,7 @@ void tst_qquickspritegoal::test_instantTransition() ensureAnimTime(600, system->m_animation); QVERIFY(system->groupData[0]->size() <= 500 && system->groupData[0]->size() >= 450); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquicktargetdirection/tst_qquicktargetdirection.cpp b/tests/auto/particles/qquicktargetdirection/tst_qquicktargetdirection.cpp index 013612d277..6e695440a0 100644 --- a/tests/auto/particles/qquicktargetdirection/tst_qquicktargetdirection.cpp +++ b/tests/auto/particles/qquicktargetdirection/tst_qquicktargetdirection.cpp @@ -31,7 +31,7 @@ void tst_qquicktargetdirection::test_basic() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquicktrailemitter/tst_qquicktrailemitter.cpp b/tests/auto/particles/qquicktrailemitter/tst_qquicktrailemitter.cpp index ef5a513b2f..230c666c8d 100644 --- a/tests/auto/particles/qquicktrailemitter/tst_qquicktrailemitter.cpp +++ b/tests/auto/particles/qquicktrailemitter/tst_qquicktrailemitter.cpp @@ -31,7 +31,7 @@ void tst_qquicktrailemitter::test_basic() ensureAnimTime(600, system->m_animation); QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused @@ -48,7 +48,7 @@ void tst_qquicktrailemitter::test_basic() } QVERIFY(extremelyFuzzyCompare(system->groupData[1]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[1]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[1]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickturbulence/tst_qquickturbulence.cpp b/tests/auto/particles/qquickturbulence/tst_qquickturbulence.cpp index 246dba20fe..d90dd17199 100644 --- a/tests/auto/particles/qquickturbulence/tst_qquickturbulence.cpp +++ b/tests/auto/particles/qquickturbulence/tst_qquickturbulence.cpp @@ -33,7 +33,7 @@ void tst_qquickturbulence::test_basic() //Note that the noise image built-in provides the 'randomness', so this test should be stable so long as it and the size //of the Turbulence item remain the same QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/particles/qquickwander/tst_qquickwander.cpp b/tests/auto/particles/qquickwander/tst_qquickwander.cpp index 6f056f5760..71a8ee1f97 100644 --- a/tests/auto/particles/qquickwander/tst_qquickwander.cpp +++ b/tests/auto/particles/qquickwander/tst_qquickwander.cpp @@ -35,7 +35,7 @@ void tst_qquickwander::test_basic() //the 500 was randomly changed from 0.0 in velocity bool vxChanged = false; bool vyChanged = false; - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp index 5a8fce6424..ab599e9a23 100644 --- a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp +++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp @@ -150,7 +150,7 @@ void tst_QQmlDebuggingEnabler::custom() m_clients = QQmlDebugTest::createOtherClients(m_connection); m_connection->connectToHost("127.0.0.1", m_process->debugPort()); QVERIFY(m_connection->waitForConnected()); - for (QQmlDebugClient *client : qAsConst(m_clients)) + for (QQmlDebugClient *client : std::as_const(m_clients)) QCOMPARE(client->state(), (services.isEmpty() || services.contains(client->name())) ? QQmlDebugClient::Enabled : QQmlDebugClient::Unavailable); } diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index 67ff637004..53971d3e8b 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -469,32 +469,32 @@ void tst_QQmlProfilerService::cleanup() if (m_client && QTest::currentTestFailed()) { qDebug() << "QML Messages:" << m_client->qmlMessages.size(); int i = 0; - for (const QQmlProfilerEvent &data : qAsConst(m_client->qmlMessages)) + for (const QQmlProfilerEvent &data : std::as_const(m_client->qmlMessages)) log(data, i++); qDebug() << " "; qDebug() << "JavaScript Messages:" << m_client->javascriptMessages.size(); i = 0; - for (const QQmlProfilerEvent &data : qAsConst(m_client->javascriptMessages)) + for (const QQmlProfilerEvent &data : std::as_const(m_client->javascriptMessages)) log(data, i++); qDebug() << " "; qDebug() << "Asynchronous Messages:" << m_client->asynchronousMessages.size(); i = 0; - for (const QQmlProfilerEvent &data : qAsConst(m_client->asynchronousMessages)) + for (const QQmlProfilerEvent &data : std::as_const(m_client->asynchronousMessages)) log(data, i++); qDebug() << " "; qDebug() << "Pixmap Cache Messages:" << m_client->pixmapMessages.size(); i = 0; - for (const QQmlProfilerEvent &data : qAsConst(m_client->pixmapMessages)) + for (const QQmlProfilerEvent &data : std::as_const(m_client->pixmapMessages)) log(data, i++); qDebug() << " "; qDebug() << "Javascript Heap Messages:" << m_client->jsHeapMessages.size(); i = 0; - for (const QQmlProfilerEvent &data : qAsConst(m_client->jsHeapMessages)) + for (const QQmlProfilerEvent &data : std::as_const(m_client->jsHeapMessages)) log(data, i++); qDebug() << " "; diff --git a/tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp b/tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp index aeeadff16a..2c69847d71 100644 --- a/tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp +++ b/tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp @@ -179,17 +179,17 @@ bool Test262Runner::report() } if (!crashes.isEmpty()) { qDebug() << " Encountered" << crashes.size() << "crashes in the following files:"; - for (const QString &f : qAsConst(crashes)) + for (const QString &f : std::as_const(crashes)) qDebug() << " " << f; } if (!unexpectedFailures.isEmpty()) { qDebug() << " Encountered" << unexpectedFailures.size() << "unexpected failures in the following files:"; - for (const QString &f : qAsConst(unexpectedFailures)) + for (const QString &f : std::as_const(unexpectedFailures)) qDebug() << " " << f; } if (!unexpectedPasses.isEmpty()) { qDebug() << " Encountered" << unexpectedPasses.size() << "unexpected passes in the following files:"; - for (const QString &f : qAsConst(unexpectedPasses)) + for (const QString &f : std::as_const(unexpectedPasses)) qDebug() << " " << f; } return crashes.isEmpty() && unexpectedFailures.isEmpty() && unexpectedPasses.isEmpty(); @@ -458,7 +458,7 @@ void Test262Runner::writeTestExpectations() QTemporaryFile expectations; expectations.open(); - for (auto c : qAsConst(testCases)) { + for (auto c : std::as_const(testCases)) { TestExpectationLine line = TestExpectationLine::fromTestCase(c); expectations.write(line.toLine()); } @@ -692,7 +692,7 @@ TestData Test262Runner::getTestData(const TestCase &testCase) data.harness += harness("assert.js"); data.harness += harness("sta.js"); - for (QByteArray inc : qAsConst(data.includes)) { + for (QByteArray inc : std::as_const(data.includes)) { inc = inc.trimmed(); data.harness += harness(inc); } diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 0a7ef4add0..4472ded31c 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -4469,7 +4469,7 @@ void tst_qqmlecmascript::singletonType() if (!errorMessage.isEmpty()) QTest::ignoreMessage(QtWarningMsg, errorMessage.toLatin1().constData()); - for (const QString &warning : qAsConst(warningMessages)) + for (const QString &warning : std::as_const(warningMessages)) QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); QScopedPointer<QObject> object(component.create()); @@ -4826,7 +4826,7 @@ void tst_qqmlecmascript::importScripts() QTest::ignoreMessage(QtWarningMsg, errorMessage.toLatin1().constData()); if (compilationShouldSucceed) { - for (const QString &warning : qAsConst(warningMessages)) + for (const QString &warning : std::as_const(warningMessages)) QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); } diff --git a/tests/auto/qml/qqmljsscope/tst_qqmljsscope.cpp b/tests/auto/qml/qqmljsscope/tst_qqmljsscope.cpp index a5efd3147e..9646e8004a 100644 --- a/tests/auto/qml/qqmljsscope/tst_qqmljsscope.cpp +++ b/tests/auto/qml/qqmljsscope/tst_qqmljsscope.cpp @@ -571,7 +571,7 @@ void tst_qqmljsscope::scriptIndices() queue.push_back(c); } - for (const QmlIR::Object *irObject : qAsConst(document.objects)) { + for (const QmlIR::Object *irObject : std::as_const(document.objects)) { const QString objectName = document.stringAt(irObject->inheritedTypeNameIndex); for (auto it = irObject->functionsBegin(); it != irObject->functionsEnd(); ++it) { QString name = document.stringAt(it->nameIndex); diff --git a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp index f0a3c19d16..14a1fa13f8 100644 --- a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp +++ b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp @@ -550,7 +550,7 @@ void tst_qqmlparser::typeAnnotations_data() QStringList files; files << findFiles(QDir(tests)); - for (const QString &file: qAsConst(files)) + for (const QString &file: std::as_const(files)) QTest::newRow(qPrintable(file)) << file; } @@ -590,7 +590,7 @@ void tst_qqmlparser::disallowedTypeAnnotations_data() QStringList files; files << findFiles(QDir(tests)); - for (const QString &file: qAsConst(files)) + for (const QString &file: std::as_const(files)) QTest::newRow(qPrintable(file)) << file; } @@ -679,7 +679,7 @@ void tst_qqmlparser::annotations_data() QStringList refFiles; refFiles << findFiles(QDir(compare)); - for (const QString &file: qAsConst(files)) { + for (const QString &file: std::as_const(files)) { auto fileNameStart = file.lastIndexOf(QDir::separator()); auto fileName = QStringView(file).mid(fileNameStart, file.length()-fileNameStart); auto ref=std::find_if(refFiles.constBegin(),refFiles.constEnd(), [fileName](const QString &s){ return s.endsWith(fileName); }); diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp index c3bf3b6181..220f449dfc 100644 --- a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp +++ b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp @@ -885,7 +885,7 @@ void tst_qqmlqt::dateTimeFormattingVariants() << component.url().toString() + ":40: TypeError: Passing incompatible arguments to C++ functions from JavaScript is not allowed." << component.url().toString() + ":43: TypeError: Passing incompatible arguments to C++ functions from JavaScript is not allowed."; - for (const QString &warning : qAsConst(warnings)) + for (const QString &warning : std::as_const(warnings)) QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); warnings.clear(); @@ -899,7 +899,7 @@ void tst_qqmlqt::dateTimeFormattingVariants() << "Could not convert argument 1 at" << "expression for err_dateTime2@"; - for (const QString &warning : qAsConst(warnings)) + for (const QString &warning : std::as_const(warnings)) QTest::ignoreMessage(QtWarningMsg, QRegularExpression(warning)); warnings.clear(); diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp index 43b86144f6..89e208f441 100644 --- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp +++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp @@ -129,10 +129,10 @@ void tst_QQMLTypeLoader::trimCache() // The cache is free to keep the others. } - for (auto *data : qAsConst(releaseCompilationUnitLater)) + for (auto *data : std::as_const(releaseCompilationUnitLater)) data->release(); - for (auto *data : qAsConst(releaseLater)) + for (auto *data : std::as_const(releaseLater)) data->release(); } diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index d1c31a080d..3127784f6a 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -223,7 +223,7 @@ void tst_examples::sgexamples_data() QStringList files; files << findQmlFiles(examplesDir); - for (const QString &file : qAsConst(files)) + for (const QString &file : std::as_const(files)) QTest::newRow(qPrintable(repoSourceDir.relativeFilePath(file))) << file; } @@ -273,7 +273,7 @@ void tst_examples::sgsnippets_data() QStringList files; files << findQmlFiles(snippetsDir); - for (const QString &file : qAsConst(files)) + for (const QString &file : std::as_const(files)) QTest::newRow(qPrintable(repoSourceDir.relativeFilePath(file))) << file; // Add Quick snippets. @@ -283,7 +283,7 @@ void tst_examples::sgsnippets_data() files.clear(); files << findQmlFiles(snippetsDir); - for (const QString &file : qAsConst(files)) + for (const QString &file : std::as_const(files)) QTest::newRow(qPrintable(repoSourceDir.relativeFilePath(file))) << file; } diff --git a/tests/auto/quick/propertyrequirements/tst_propertyrequirements.cpp b/tests/auto/quick/propertyrequirements/tst_propertyrequirements.cpp index 4734382fc8..b8de922777 100644 --- a/tests/auto/quick/propertyrequirements/tst_propertyrequirements.cpp +++ b/tests/auto/quick/propertyrequirements/tst_propertyrequirements.cpp @@ -160,7 +160,7 @@ void tst_PropertyRequirements::testQmlType(TestDepth testDepth, const QQmlType & inheritanceHierarchy.append(qmlType.metaObject()); } - for (const QMetaObject *metaClass : qAsConst(inheritanceHierarchy)) { + for (const QMetaObject *metaClass : std::as_const(inheritanceHierarchy)) { for (int idx = metaClass->propertyOffset(); idx < metaClass->propertyCount(); ++idx) { const QMetaProperty property = metaClass->property(idx); diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 3245ead111..bc372fd040 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -9872,7 +9872,7 @@ void tst_QQuickListView::reuse_checkThatItemsAreReused() QCOMPARE(listView->property("delegatesCreatedCount").toInt(), initialItemCount); // Go through all the initial items and check that they have not been reused yet - for (const auto item : qAsConst(items)) + for (const auto item : std::as_const(items)) QCOMPARE(item->property("reusedCount").toInt(), 0); // Flick one page down and count how many items we have created thus @@ -9896,7 +9896,7 @@ void tst_QQuickListView::reuse_checkThatItemsAreReused() // QML model classes, we need to catch it through a binding instead (which is // OK, since then we can also check that bindings are updated when reused). items = findItems<QQuickItem>(listView, "delegate"); - for (const auto item : qAsConst(items)) { + for (const auto item : std::as_const(items)) { const QString display = item->property("displayBinding").toString(); const int modelIndex = item->property("modelIndex").toInt(); QVERIFY(modelIndex >= initialItemCount); @@ -9918,7 +9918,7 @@ void tst_QQuickListView::reuse_checkThatItemsAreReused() // (except for ListView.currentItem, which was never released). const auto listViewCurrentItem = listView->currentItem(); items = findItems<QQuickItem>(listView, "delegate"); - for (const auto item : qAsConst(items)) { + for (const auto item : std::as_const(items)) { const int reusedCount = item->property("reusedCount").toInt(); if (item == listViewCurrentItem) QCOMPARE(reusedCount, 0); @@ -9929,7 +9929,7 @@ void tst_QQuickListView::reuse_checkThatItemsAreReused() // Go through all items again and check that all model data inside the delegate // have correct values now that they have been reused. items = findItems<QQuickItem>(listView, "delegate"); - for (const auto item : qAsConst(items)) { + for (const auto item : std::as_const(items)) { const QString display = item->property("displayBinding").toString(); const int modelIndex = item->property("modelIndex").toInt(); QVERIFY(modelIndex < initialItemCount); diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index 122ac3e029..98085002ea 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -2692,7 +2692,7 @@ void tst_QQuickPathView::objectModelMove() QVector<QString> itemObjectNames; itemObjectNames << QLatin1String("red") << QLatin1String("green") << QLatin1String("blue"); QVector<QQuickItem*> childItems; - for (const QString &itemObjectName : qAsConst(itemObjectNames)) { + for (const QString &itemObjectName : std::as_const(itemObjectNames)) { QQuickItem *childItem = findItem<QQuickItem>(pathView, itemObjectName); QVERIFY(childItem); childItems.append(childItem); @@ -2705,7 +2705,7 @@ void tst_QQuickPathView::objectModelMove() QTRY_VERIFY(pathView.isNull()); // By this point, all of its cached items should have been released, // which means none of the items should have any listeners. - for (const auto childItem : qAsConst(childItems)) { + for (const auto childItem : std::as_const(childItems)) { const QQuickItemPrivate *childItemPrivate = QQuickItemPrivate::get(childItem); QCOMPARE(childItemPrivate->changeListeners.size(), 0); } diff --git a/tests/auto/quickcontrols2/customization/tst_customization.cpp b/tests/auto/quickcontrols2/customization/tst_customization.cpp index f22af1d5b8..1ee39ae254 100644 --- a/tests/auto/quickcontrols2/customization/tst_customization.cpp +++ b/tests/auto/quickcontrols2/customization/tst_customization.cpp @@ -293,7 +293,7 @@ void tst_customization::creation() QCOMPARE(control->objectName(), controlName); QVERIFY2(qt_createdQObjects()->removeOne(controlName), qPrintable(controlName + " was not created as expected")); - for (QString delegate : qAsConst(delegates)) { + for (QString delegate : std::as_const(delegates)) { QStringList properties = delegate.split(".", Qt::SkipEmptyParts); // <control>-<delegate>-<style>(-<override>) @@ -390,7 +390,7 @@ void tst_customization::override() QCOMPARE(control->objectName(), controlName); QVERIFY2(qt_createdQObjects()->removeOne(controlName), qPrintable(controlName + " was not created as expected")); - for (QString delegate : qAsConst(delegates)) { + for (QString delegate : std::as_const(delegates)) { QStringList properties = delegate.split(".", Qt::SkipEmptyParts); // <control>-<delegate>-<style>(-override) @@ -420,7 +420,7 @@ void tst_customization::override() if (!nonDeferred.isEmpty()) { // There were items for which deferred execution was not possible. - for (QString delegateName : qAsConst(delegates)) { + for (QString delegateName : std::as_const(delegates)) { if (!delegateName.contains("-")) delegateName.append("-" + nonDeferred); delegateName.prepend(type.toLower() + "-"); diff --git a/tests/auto/quickcontrols2/focus/tst_focus.cpp b/tests/auto/quickcontrols2/focus/tst_focus.cpp index 98b2f3bd24..ca70146885 100644 --- a/tests/auto/quickcontrols2/focus/tst_focus.cpp +++ b/tests/auto/quickcontrols2/focus/tst_focus.cpp @@ -93,7 +93,7 @@ void tst_focus::navigation() QVERIFY(QTest::qWaitForWindowActive(&view)); QVERIFY(QGuiApplication::focusWindow() == &view); - for (const QString &name : qAsConst(order)) { + for (const QString &name : std::as_const(order)) { QKeyEvent event(QEvent::KeyPress, key, Qt::NoModifier); QGuiApplication::sendEvent(&view, &event); QVERIFY(event.isAccepted()); diff --git a/tests/auto/quickcontrols2/qquickiconlabel/tst_qquickiconlabel.cpp b/tests/auto/quickcontrols2/qquickiconlabel/tst_qquickiconlabel.cpp index 5aab4a0f09..8d42cf5faf 100644 --- a/tests/auto/quickcontrols2/qquickiconlabel/tst_qquickiconlabel.cpp +++ b/tests/auto/quickcontrols2/qquickiconlabel/tst_qquickiconlabel.cpp @@ -130,7 +130,7 @@ void tst_qquickiconlabel::display() // Test that the icon and text are correctly positioned and sized after // setting several different display types in succession. - for (QQuickIconLabel::Display displayType : qAsConst(displayTypes)) { + for (QQuickIconLabel::Display displayType : std::as_const(displayTypes)) { label->setDisplay(displayType); QCOMPARE(label->display(), displayType); diff --git a/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp b/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp index e125cb28ff..1a615ae948 100644 --- a/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp +++ b/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp @@ -1033,7 +1033,7 @@ void tst_QQuickFileDialogImpl::tabFocusNavigation() } // Tab through each item, checking the focus after each. - for (auto expectedFocusItem : qAsConst(expectedFocusItems)) { + for (auto expectedFocusItem : std::as_const(expectedFocusItems)) { // Check the focus item first so that we account for the first item. // Print detailed failure message as workaround for QTBUG-92102. QVERIFY2(dialogHelper.window()->activeFocusItem() == expectedFocusItem, qPrintable(QString::fromLatin1( @@ -1048,7 +1048,7 @@ void tst_QQuickFileDialogImpl::tabFocusNavigation() std::reverse(expectedFocusItems.begin(), expectedFocusItems.end()); // We know the first (last) item has focus already, so skip it. expectedFocusItems.removeFirst(); - for (auto expectedFocusItem : qAsConst(expectedFocusItems)) { + for (auto expectedFocusItem : std::as_const(expectedFocusItems)) { QTest::keyClick(dialogHelper.window(), Qt::Key_Tab, Qt::ShiftModifier); QCOMPARE(dialogHelper.window()->activeFocusItem(), expectedFocusItem); diff --git a/tests/auto/quickdialogs/qquickfolderdialogimpl/tst_qquickfolderdialogimpl.cpp b/tests/auto/quickdialogs/qquickfolderdialogimpl/tst_qquickfolderdialogimpl.cpp index a4b445b50b..01116aa7e9 100644 --- a/tests/auto/quickdialogs/qquickfolderdialogimpl/tst_qquickfolderdialogimpl.cpp +++ b/tests/auto/quickdialogs/qquickfolderdialogimpl/tst_qquickfolderdialogimpl.cpp @@ -687,7 +687,7 @@ void tst_QQuickFolderDialogImpl::tabFocusNavigation() } // Tab through each item, checking the focus after each. - for (auto expectedFocusItem : qAsConst(expectedFocusItems)) { + for (auto expectedFocusItem : std::as_const(expectedFocusItems)) { // Check the focus item first so that we account for the first item. // Print detailed failure message as workaround for QTBUG-92102. QVERIFY2(dialogHelper.window()->activeFocusItem() == expectedFocusItem, qPrintable(QString::fromLatin1( @@ -702,7 +702,7 @@ void tst_QQuickFolderDialogImpl::tabFocusNavigation() std::reverse(expectedFocusItems.begin(), expectedFocusItems.end()); // We know the first (last) item has focus already, so skip it. expectedFocusItems.removeFirst(); - for (auto expectedFocusItem : qAsConst(expectedFocusItems)) { + for (auto expectedFocusItem : std::as_const(expectedFocusItems)) { QTest::keyClick(dialogHelper.window(), Qt::Key_Tab, Qt::ShiftModifier); QCOMPARE(dialogHelper.window()->activeFocusItem(), expectedFocusItem); diff --git a/tests/baseline/controls/tst_baseline_controls.cpp b/tests/baseline/controls/tst_baseline_controls.cpp index 2e69bebfce..1faed68311 100644 --- a/tests/baseline/controls/tst_baseline_controls.cpp +++ b/tests/baseline/controls/tst_baseline_controls.cpp @@ -182,7 +182,7 @@ void tst_Baseline_Controls::setupTestSuite() if (testFiles.isEmpty()) QSKIP("No .qml test files found in " + testSuitePath.toLatin1()); - for (const auto &filePath : qAsConst(testFiles)) { + for (const auto &filePath : std::as_const(testFiles)) { QString itemName = filePath.sliced(testSuitePath.size() + 1); itemName = itemName.left(itemName.size() - qmlExt.size()); QBaselineTest::newRow(itemName.toLatin1()) << filePath; diff --git a/tests/baseline/scenegraph/scenegraph/tst_baseline_scenegraph.cpp b/tests/baseline/scenegraph/scenegraph/tst_baseline_scenegraph.cpp index 5bab4aa4ef..124580f3b6 100644 --- a/tests/baseline/scenegraph/scenegraph/tst_baseline_scenegraph.cpp +++ b/tests/baseline/scenegraph/scenegraph/tst_baseline_scenegraph.cpp @@ -166,7 +166,7 @@ void tst_Scenegraph::setupTestSuite(const QByteArray& filter) } std::sort(itemFiles.begin(), itemFiles.end()); - for (const QString &filePath : qAsConst(itemFiles)) { + for (const QString &filePath : std::as_const(itemFiles)) { QByteArray itemName = filePath.mid(testSuitePath.size() + 1).toLatin1(); QBaselineTest::newRow(itemName, checksumFileOrDir(filePath)) << filePath; numItems++; diff --git a/tests/benchmarks/particles/affectors/tst_affectors.cpp b/tests/benchmarks/particles/affectors/tst_affectors.cpp index abce304f9a..172d986186 100644 --- a/tests/benchmarks/particles/affectors/tst_affectors.cpp +++ b/tests/benchmarks/particles/affectors/tst_affectors.cpp @@ -66,7 +66,7 @@ void tst_affectors::test_basic() int stillAlive = 0; QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 1000, 10));//Small simulation variance is permissible. - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused @@ -106,7 +106,7 @@ void tst_affectors::test_filtered() int stillAlive = 0; QVERIFY(extremelyFuzzyCompare(system->groupData[1]->size(), 1000, 10));//Small simulation variance is permissible. - for (QQuickParticleData *d : qAsConst(system->groupData[1]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[1]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/benchmarks/particles/emission/tst_emission.cpp b/tests/benchmarks/particles/emission/tst_emission.cpp index 155e2c6cff..875906ad45 100644 --- a/tests/benchmarks/particles/emission/tst_emission.cpp +++ b/tests/benchmarks/particles/emission/tst_emission.cpp @@ -54,7 +54,7 @@ void tst_emission::test_basic() int stillAlive = 0; QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 1000, 10));//Small simulation variance is permissible. - for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) { + for (QQuickParticleData *d : std::as_const(system->groupData[0]->data)) { if (d->t == -1) continue; //Particle data unused diff --git a/tests/benchmarks/quickcontrols2/objectcount/tst_objectcount.cpp b/tests/benchmarks/quickcontrols2/objectcount/tst_objectcount.cpp index 4c4e5220c4..e1d37eec8f 100644 --- a/tests/benchmarks/quickcontrols2/objectcount/tst_objectcount.cpp +++ b/tests/benchmarks/quickcontrols2/objectcount/tst_objectcount.cpp @@ -89,7 +89,7 @@ static void doBenchmark(QQmlEngine *engine, const QUrl &url) QVERIFY2(object.data(), qPrintable(component.errorString())); QObjectList objects; - for (QObject *object : qAsConst(*qt_qobjects())) { + for (QObject *object : std::as_const(*qt_qobjects())) { if (qobject_cast<T *>(object)) objects += object; } diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 98fefcb838..9ad2abe781 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -236,7 +236,7 @@ public Q_SLOTS: if (o) { checkForWindow(o); if (conf && qae) - for (PartialScene *ps : qAsConst(conf->completers)) + for (PartialScene *ps : std::as_const(conf->completers)) if (o->inherits(ps->itemType().toUtf8().constData())) contain(o, ps->container()); } @@ -612,7 +612,7 @@ int main(int argc, char *argv[]) } #endif - for (const QString &path : qAsConst(files)) { + for (const QString &path : std::as_const(files)) { QUrl url = QUrl::fromUserInput(path, QDir::currentPath(), QUrl::AssumeLocalFile); if (verboseMode) printf("qml: loading %s\n", qPrintable(url.toString())); diff --git a/tools/qmldom/qmldomtool.cpp b/tools/qmldom/qmldomtool.cpp index 1e8de35f5d..badf1917f9 100644 --- a/tools/qmldom/qmldomtool.cpp +++ b/tools/qmldom/qmldomtool.cpp @@ -188,10 +188,10 @@ int main(int argc, char *argv[]) { QDebug dbg = qDebug(); dbg << "dirs:\n"; - for (const QString &d : qAsConst(qmltypeDirs)) + for (const QString &d : std::as_const(qmltypeDirs)) dbg << " '" << d << "'\n"; dbg << "files:\n"; - for (const QString &f : qAsConst(positionalArguments)) + for (const QString &f : std::as_const(positionalArguments)) dbg << " '" << f << "'\n"; dbg << "fieldFilter: " << filter.describeFieldsFilter(); dbg << "\n"; @@ -206,7 +206,7 @@ int main(int argc, char *argv[]) env.loadBuiltins(); QList<DomItem> loadedFiles(positionalArguments.size()); qsizetype iPos = 0; - for (const QString &s : qAsConst(positionalArguments)) { + for (const QString &s : std::as_const(positionalArguments)) { env.loadFile( s, QString(), [&loadedFiles, iPos](Path, const DomItem &, const DomItem &newIt) { diff --git a/tools/qmleasing/splineeditor.cpp b/tools/qmleasing/splineeditor.cpp index 700cb9ff34..dc71adafa4 100644 --- a/tools/qmleasing/splineeditor.cpp +++ b/tools/qmleasing/splineeditor.cpp @@ -265,7 +265,7 @@ QHash<QString, QEasingCurve> SplineEditor::presets() const QString SplineEditor::generateCode() { QString s = QLatin1String("["); - for (const QPointF &point : qAsConst(m_controlPoints)) { + for (const QPointF &point : std::as_const(m_controlPoints)) { s += QString::number(point.x(), 'g', 2) + QLatin1Char(',') + QString::number(point.y(), 'g', 3) + QLatin1Char(','); } diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp index 1b2dbf285c..18e784a658 100644 --- a/tools/qmlimportscanner/main.cpp +++ b/tools/qmlimportscanner/main.cpp @@ -281,7 +281,7 @@ QPair<QString, QString> resolveImportPath(const QString &uri, const QString &ver QString ver = version; QPair<QString, QString> candidate; while (true) { - for (const QString &qmlImportPath : qAsConst(g_qmlImportPaths)) { + for (const QString &qmlImportPath : std::as_const(g_qmlImportPaths)) { // Search for the most specific version first, and search // also for the version in parent modules. For example: // - qml/QtQml/Models.2.0 diff --git a/tools/qmljs/qmljs.cpp b/tools/qmljs/qmljs.cpp index 69f6b15299..c874caf752 100644 --- a/tools/qmljs/qmljs.cpp +++ b/tools/qmljs/qmljs.cpp @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) QV4::GlobalExtensions::init(vm.globalObject, QJSEngine::ConsoleExtension | QJSEngine::GarbageCollectionExtension); - for (const QString &fn : qAsConst(args)) { + for (const QString &fn : std::as_const(args)) { QV4::ScopedValue result(scope); if (runAsModule) { auto moduleUnit = vm.loadModule(QUrl::fromLocalFile(QFileInfo(fn).absoluteFilePath())); diff --git a/tools/qmlls/qlanguageserver.cpp b/tools/qmlls/qlanguageserver.cpp index 70cbd354b0..4f9c9fe77d 100644 --- a/tools/qmlls/qlanguageserver.cpp +++ b/tools/qmlls/qlanguageserver.cpp @@ -203,7 +203,7 @@ void QLanguageServer::setupCapabilities(const QLspSpecification::InitializeParam QLspSpecification::InitializeResult &serverInfo) { Q_D(QLanguageServer); - for (auto module : qAsConst(d->modules)) + for (auto module : std::as_const(d->modules)) module->setupCapabilities(clientInfo, serverInfo); } diff --git a/tools/qmlls/qmlcompletionsupport.cpp b/tools/qmlls/qmlcompletionsupport.cpp index 8078e09adf..0788174532 100644 --- a/tools/qmlls/qmlcompletionsupport.cpp +++ b/tools/qmlls/qmlcompletionsupport.cpp @@ -468,7 +468,7 @@ static QList<CompletionItem> reachableSymbols(DomItem &context, const Completion QString label = it.key() + u"("; QString doc = it.key() + u"("; bool first = true; - for (const MethodParameter &pInfo : qAsConst(it->parameters)) { + for (const MethodParameter &pInfo : std::as_const(it->parameters)) { if (first) first = false; else { diff --git a/tools/qmlls/qqmlcodemodel.cpp b/tools/qmlls/qqmlcodemodel.cpp index 5d6c70790a..b8a018c985 100644 --- a/tools/qmlls/qqmlcodemodel.cpp +++ b/tools/qmlls/qqmlcodemodel.cpp @@ -112,7 +112,7 @@ int QQmlCodeModel::indexEvalProgress() const Q_ASSERT(!m_mutex.tryLock()); // should be called while locked const int dirCost = 10; int costToDo = 1; - for (const ToIndex &el : qAsConst(m_toIndex)) + for (const ToIndex &el : std::as_const(m_toIndex)) costToDo += dirCost * el.leftDepth; costToDo += m_indexInProgressCost; return m_indexDoneCost * 100 / (costToDo + m_indexDoneCost); diff --git a/tools/qmlls/workspace.cpp b/tools/qmlls/workspace.cpp index 8291afc671..a18d5f6f8d 100644 --- a/tools/qmlls/workspace.cpp +++ b/tools/qmlls/workspace.cpp @@ -152,7 +152,7 @@ void WorkspaceHandlers::clientInitialized(QLanguageServer *server) if (clientInfo.workspaceFolders && std::holds_alternative<QList<WorkspaceFolder>>(*clientInfo.workspaceFolders)) { for (const WorkspaceFolder &workspace : - qAsConst(std::get<QList<WorkspaceFolder>>(*clientInfo.workspaceFolders))) { + std::as_const(std::get<QList<WorkspaceFolder>>(*clientInfo.workspaceFolders))) { const QUrl workspaceUrl(QString::fromUtf8(QmlLsp::lspUriToQmlUrl(workspace.uri))); rootPaths.insert(workspaceUrl.toLocalFile()); } diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index 70bb52463d..86466a3928 100644 --- a/tools/qmlplugindump/main.cpp +++ b/tools/qmlplugindump/main.cpp @@ -496,7 +496,7 @@ public: } } - for (const QMetaObject *meta : qAsConst(objectsToMerge)) { + for (const QMetaObject *meta : std::as_const(objectsToMerge)) { for (int index = meta->enumeratorOffset(); index < meta->enumeratorCount(); ++index) dump(meta->enumerator(index)); @@ -885,7 +885,7 @@ static bool getDependencies(const QQmlEngine &engine, const QString &pluginImpor if (!importScanner.waitForFinished()) { std::cerr << "failure to start " << qPrintable(command); - for (const QString &arg : qAsConst(commandArgs)) + for (const QString &arg : std::as_const(commandArgs)) std::cerr << ' ' << qPrintable(arg); std::cerr << std::endl; return false; @@ -1198,7 +1198,7 @@ int main(int argc, char *argv[]) // load the QtQml builtins and the dependencies { QByteArray code(qtQmlImportString.toUtf8()); - for (const QString &moduleToImport : qAsConst(dependencies)) { + for (const QString &moduleToImport : std::as_const(dependencies)) { code.append("\nimport "); code.append(moduleToImport.toUtf8()); } @@ -1262,7 +1262,7 @@ int main(int argc, char *argv[]) QString::number(qtObjectType.version().minorVersion())).toUtf8(); } // avoid importing dependencies? - for (const QString &moduleToImport : qAsConst(dependencies)) { + for (const QString &moduleToImport : std::as_const(dependencies)) { importCode.append("\nimport "); importCode.append(moduleToImport.toUtf8()); } @@ -1299,7 +1299,7 @@ int main(int argc, char *argv[]) it->erase(std::unique(it->begin(), it->end()), it->end()); } - for (const QMetaObject *mo : qAsConst(candidates)) { + for (const QMetaObject *mo : std::as_const(candidates)) { if (mo->className() != QLatin1String("Qt")) metas.insert(mo); } @@ -1327,13 +1327,13 @@ int main(int argc, char *argv[]) // put the metaobjects into a map so they are always dumped in the same order QMap<QString, const QMetaObject *> nameToMeta; - for (const QMetaObject *meta : qAsConst(metas)) + for (const QMetaObject *meta : std::as_const(metas)) nameToMeta.insert(convertToId(meta), meta); Dumper dumper(&qml); if (relocatable) dumper.setRelocatableModuleUri(pluginImportUri); - for (const QMetaObject *meta : qAsConst(nameToMeta)) { + for (const QMetaObject *meta : std::as_const(nameToMeta)) { dumper.dump(QQmlEnginePrivate::get(&engine), meta, uncreatableMetas.contains(meta), singletonMetas.contains(meta)); } diff --git a/tools/qmlpreview/qmlpreviewfilesystemwatcher.cpp b/tools/qmlpreview/qmlpreviewfilesystemwatcher.cpp index 9034b3559e..4db2c03b20 100644 --- a/tools/qmlpreview/qmlpreviewfilesystemwatcher.cpp +++ b/tools/qmlpreview/qmlpreviewfilesystemwatcher.cpp @@ -119,7 +119,7 @@ void QmlPreviewFileSystemWatcher::onDirectoryChanged(const QString &path) toReadd.removeOne(rejected); // If we've successfully added the file, that means it was deleted and replaced. - for (const QString &reAdded : qAsConst(toReadd)) + for (const QString &reAdded : std::as_const(toReadd)) emit fileChanged(reAdded); } } diff --git a/tools/qmlprofiler/qmlprofilerdata.cpp b/tools/qmlprofiler/qmlprofilerdata.cpp index cac1364b87..8f75226fd8 100644 --- a/tools/qmlprofiler/qmlprofilerdata.cpp +++ b/tools/qmlprofiler/qmlprofilerdata.cpp @@ -211,7 +211,7 @@ void QmlProfilerData::computeQmlTime() qint64 level0Start = -1; int level = 0; - for (const QQmlProfilerEvent &event : qAsConst(d->events)) { + for (const QQmlProfilerEvent &event : std::as_const(d->events)) { const QQmlProfilerEventType &type = d->eventTypes.at(event.typeIndex()); if (type.message() != MaximumMessage) continue; @@ -510,7 +510,7 @@ bool QmlProfilerData::save(const QString &filename) } }; - for (const QQmlProfilerEvent &event : qAsConst(d->events)) { + for (const QQmlProfilerEvent &event : std::as_const(d->events)) { const QQmlProfilerEventType &type = d->eventTypes.at(event.typeIndex()); if (type.rangeType() != MaximumRangeType) { diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index 0bff754e4c..891b7534bd 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -454,7 +454,7 @@ int main(int argc, char ** argv) } QSurfaceFormat::setDefaultFormat(surfaceFormat); - for (Qt::ApplicationAttribute a : qAsConst(options.applicationAttributes)) + for (Qt::ApplicationAttribute a : std::as_const(options.applicationAttributes)) QCoreApplication::setAttribute(a); QScopedPointer<QGuiApplication> app; #ifdef QT_WIDGETS_LIB diff --git a/tools/qmltc/qmltccodewriter.cpp b/tools/qmltc/qmltccodewriter.cpp index 7c9958e215..b2722d1e37 100644 --- a/tools/qmltc/qmltccodewriter.cpp +++ b/tools/qmltc/qmltccodewriter.cpp @@ -199,23 +199,23 @@ void QmltcCodeWriter::write(QmltcOutputWrapper &code, const QmltcProgram &progra writeUrl(code, program.urlMethod); // forward declare all the types first - for (const QmltcType &type : qAsConst(program.compiledTypes)) + for (const QmltcType &type : std::as_const(program.compiledTypes)) code.rawAppendToHeader(u"class " + type.cppType + u";"); // write all the types and their content - for (const QmltcType &type : qAsConst(program.compiledTypes)) + for (const QmltcType &type : std::as_const(program.compiledTypes)) write(code, type); // add typeCount definitions. after all types have been written down (so // they are now complete types as per C++). practically, this only concerns // document root type - for (const QmltcType &type : qAsConst(program.compiledTypes)) { + for (const QmltcType &type : std::as_const(program.compiledTypes)) { if (!type.typeCount) continue; code.rawAppendToHeader(u""); // blank line code.rawAppendToHeader(u"constexpr %1 %2::%3()"_s.arg(type.typeCount->returnType, type.cppType, type.typeCount->name)); code.rawAppendToHeader(u"{"); - for (const QString &line : qAsConst(type.typeCount->body)) + for (const QString &line : std::as_const(type.typeCount->body)) code.rawAppendToHeader(line, 1); code.rawAppendToHeader(u"}"); } @@ -240,7 +240,7 @@ static void dumpFunctions(QmltcOutputWrapper &code, const QList<QmltcMethod> &fu for (auto it = orderedFunctions.cbegin(); it != orderedFunctions.cend(); ++it) { code.rawAppendToHeader(it.key() + u":", -1); - for (const QmltcMethod *function : qAsConst(it.value())) + for (const QmltcMethod *function : std::as_const(it.value())) QmltcCodeWriter::write(code, *function); } } @@ -264,7 +264,7 @@ void QmltcCodeWriter::write(QmltcOutputWrapper &code, const QmltcType &type) code.rawAppendToHeader(constructClassString()); code.rawAppendToHeader(u"{"); - for (const QString &mocLine : qAsConst(type.mocCode)) + for (const QString &mocLine : std::as_const(type.mocCode)) code.rawAppendToHeader(mocLine, 1); QmltcOutputWrapper::MemberNameScope typeScope(&code, type.cppType); @@ -294,7 +294,7 @@ void QmltcCodeWriter::write(QmltcOutputWrapper &code, const QmltcType &type) QmltcCodeWriter::write(code, *type.dtor); // enums - for (const auto &enumeration : qAsConst(type.enums)) + for (const auto &enumeration : std::as_const(type.enums)) QmltcCodeWriter::write(code, enumeration); // visible functions @@ -331,7 +331,7 @@ void QmltcCodeWriter::write(QmltcOutputWrapper &code, const QmltcType &type) } // children - for (const auto &child : qAsConst(type.children)) + for (const auto &child : std::as_const(type.children)) QmltcCodeWriter::write(code, child); // (non-visible) functions @@ -342,14 +342,14 @@ void QmltcCodeWriter::write(QmltcOutputWrapper &code, const QmltcType &type) code.rawAppendToHeader(u""); // blank line code.rawAppendToHeader(u"protected:", -1); } - for (const auto &property : qAsConst(type.properties)) + for (const auto &property : std::as_const(type.properties)) write(code, property); - for (const auto &variable : qAsConst(type.variables)) + for (const auto &variable : std::as_const(type.variables)) write(code, variable); } code.rawAppendToHeader(u"private:", -1); - for (const QString &otherLine : qAsConst(type.otherCode)) + for (const QString &otherLine : std::as_const(type.otherCode)) code.rawAppendToHeader(otherLine, 1); if (type.typeCount) { @@ -396,7 +396,7 @@ void QmltcCodeWriter::write(QmltcOutputWrapper &code, const QmltcMethod &method) { QmltcOutputWrapper::CppIndentationScope cppIndent(&code); Q_UNUSED(cppIndent); - for (const QString &line : qAsConst(method.body)) + for (const QString &line : std::as_const(method.body)) code.rawAppendToCpp(line); } code.rawAppendToCpp(u"}"); @@ -419,7 +419,7 @@ static void writeSpecialMethod(QmltcOutputWrapper &code, const QmltcMethodBase & { QmltcOutputWrapper::CppIndentationScope cppIndent(&code); Q_UNUSED(cppIndent); - for (const QString &line : qAsConst(specialMethod.body)) + for (const QString &line : std::as_const(specialMethod.body)) code.rawAppendToCpp(line); } code.rawAppendToCpp(u"}"); @@ -472,7 +472,7 @@ void QmltcCodeWriter::writeUrl(QmltcOutputWrapper &code, const QmltcMethod &urlM { QmltcOutputWrapper::CppIndentationScope cppIndent(&code); Q_UNUSED(cppIndent); - for (const QString &line : qAsConst(urlMethod.body)) + for (const QString &line : std::as_const(urlMethod.body)) code.rawAppendToCpp(line); } code.rawAppendToCpp(u"}"); diff --git a/tools/qmltc/qmltccompiler.cpp b/tools/qmltc/qmltccompiler.cpp index ba2a0fd5fb..a8200d41d1 100644 --- a/tools/qmltc/qmltccompiler.cpp +++ b/tools/qmltc/qmltccompiler.cpp @@ -310,7 +310,7 @@ void QmltcCompiler::compileTypeElements(QmltcType ¤t, const QQmlJSScope::C [](const QQmlJSMetaProperty &x, const QQmlJSMetaProperty &y) { return x.index() < y.index(); }); - for (const QQmlJSMetaProperty &p : qAsConst(properties)) { + for (const QQmlJSMetaProperty &p : std::as_const(properties)) { if (p.index() == -1) { recordError(type->sourceLocation(), u"Internal error: property '%1' has incomplete information"_s.arg( @@ -1042,7 +1042,7 @@ void QmltcCompiler::compileBinding(QmltcType ¤t, const QQmlJSMetaPropertyB auto subbindings = attachedType->ownPropertyBindingsInQmlIROrder(); // compile bindings of the attached property partitionBindings(subbindings.begin(), subbindings.end()); - for (const auto &b : qAsConst(subbindings)) { + for (const auto &b : std::as_const(subbindings)) { compileBinding(current, b, attachedType, { type, attachedMemberName, propertyName, false }); } diff --git a/tools/qmltc/qmltcvisitor.cpp b/tools/qmltc/qmltcvisitor.cpp index a219e02e53..d15f1dbe2f 100644 --- a/tools/qmltc/qmltcvisitor.cpp +++ b/tools/qmltc/qmltcvisitor.cpp @@ -313,7 +313,7 @@ void QmltcVisitor::endVisit(QQmlJS::AST::UiProgram *program) return; QHash<QQmlJSScope::ConstPtr, QList<QQmlJSMetaPropertyBinding>> bindings; - for (const QQmlJSScope::ConstPtr &type : qAsConst(m_qmlTypes)) { + for (const QQmlJSScope::ConstPtr &type : std::as_const(m_qmlTypes)) { if (isOrUnderComponent(type)) continue; bindings.insert(type, type->ownPropertyBindingsInQmlIROrder()); @@ -486,7 +486,7 @@ void QmltcVisitor::postVisitResolve( // add explicit components to the object creation indices { qsizetype index = 0; - for (const QQmlJSScope::ConstPtr &c : qAsConst(explicitComponents)) + for (const QQmlJSScope::ConstPtr &c : std::as_const(explicitComponents)) m_creationIndices[c] = m_pureQmlTypes.size() + index++; } diff --git a/tools/shared/qqmltoolingsettings.cpp b/tools/shared/qqmltoolingsettings.cpp index 6bfd419aa2..dffd59fbc7 100644 --- a/tools/shared/qqmltoolingsettings.cpp +++ b/tools/shared/qqmltoolingsettings.cpp @@ -83,7 +83,7 @@ bool QQmlToolingSettings::search(const QString &path) const QString iniFile = dir.absoluteFilePath(settingsFileName); if (read(iniFile)) { - for (const QString &dir : qAsConst(dirs)) + for (const QString &dir : std::as_const(dirs)) m_seenDirectories[dir] = iniFile; return true; } @@ -94,7 +94,7 @@ bool QQmlToolingSettings::search(const QString &path) if (const QString iniFile = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, u"%1.ini"_s.arg(m_toolName)); !iniFile.isEmpty()) { if (read(iniFile)) { - for (const QString &dir : qAsConst(dirs)) + for (const QString &dir : std::as_const(dirs)) m_seenDirectories[dir] = iniFile; return true; } @@ -102,7 +102,7 @@ bool QQmlToolingSettings::search(const QString &path) // No INI file found anywhere, record the failure so we won't have to traverse the entire // filesystem again - for (const QString &dir : qAsConst(dirs)) + for (const QString &dir : std::as_const(dirs)) m_seenDirectories[dir] = QString(); return false; |