summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-11-11 16:26:04 +0100
committerMarc Mutz <marc.mutz@qt.io>2022-11-18 22:01:16 +0100
commitd45b9beffa79db3ad4b67439e9caf40843f50c1a (patch)
tree8b04745f1a571b9b6f16217bd063364e1ec92046 /examples
parentc6f7a403e3c89bfbf8ed6d39b8d54c6ec809dbbd (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>
Diffstat (limited to 'examples')
-rw-r--r--examples/statemachine/animation/stickman/animation.cpp2
-rw-r--r--examples/statemachine/animation/sub-attaq/animationmanager.cpp4
-rw-r--r--examples/statemachine/animation/sub-attaq/graphicsscene.cpp6
3 files changed, 6 insertions, 6 deletions
diff --git a/examples/statemachine/animation/stickman/animation.cpp b/examples/statemachine/animation/stickman/animation.cpp
index b02a7e9..9109732 100644
--- a/examples/statemachine/animation/stickman/animation.cpp
+++ b/examples/statemachine/animation/stickman/animation.cpp
@@ -110,7 +110,7 @@ void Animation::save(QIODevice *device) const
QDataStream stream(device);
stream << m_name;
stream << m_frames.size();
- for (const Frame *frame : qAsConst(m_frames)) {
+ for (const Frame *frame : std::as_const(m_frames)) {
stream << frame->nodeCount();
for (int i = 0; i < frame->nodeCount(); ++i)
stream << frame->nodePos(i);
diff --git a/examples/statemachine/animation/sub-attaq/animationmanager.cpp b/examples/statemachine/animation/sub-attaq/animationmanager.cpp
index 4be1706..2064eac 100644
--- a/examples/statemachine/animation/sub-attaq/animationmanager.cpp
+++ b/examples/statemachine/animation/sub-attaq/animationmanager.cpp
@@ -37,14 +37,14 @@ void AnimationManager::unregisterAllAnimations()
void AnimationManager::pauseAll()
{
- for (QAbstractAnimation *animation : qAsConst(animations)) {
+ for (QAbstractAnimation *animation : std::as_const(animations)) {
if (animation->state() == QAbstractAnimation::Running)
animation->pause();
}
}
void AnimationManager::resumeAll()
{
- for (QAbstractAnimation *animation : qAsConst(animations)) {
+ for (QAbstractAnimation *animation : std::as_const(animations)) {
if (animation->state() == QAbstractAnimation::Paused)
animation->resume();
}
diff --git a/examples/statemachine/animation/sub-attaq/graphicsscene.cpp b/examples/statemachine/animation/sub-attaq/graphicsscene.cpp
index 0c31623..13c8b09 100644
--- a/examples/statemachine/animation/sub-attaq/graphicsscene.cpp
+++ b/examples/statemachine/animation/sub-attaq/graphicsscene.cpp
@@ -229,21 +229,21 @@ void GraphicsScene::onSubMarineExecutionFinished()
void GraphicsScene::clearScene()
{
- for (SubMarine *sub : qAsConst(submarines)) {
+ for (SubMarine *sub : std::as_const(submarines)) {
// make sure to not go into onSubMarineExecutionFinished
sub->disconnect(this);
sub->destroy();
sub->deleteLater();
}
- for (Torpedo *torpedo : qAsConst(torpedos)) {
+ for (Torpedo *torpedo : std::as_const(torpedos)) {
// make sure to not go into onTorpedoExecutionFinished
torpedo->disconnect(this);
torpedo->destroy();
torpedo->deleteLater();
}
- for (Bomb *bomb : qAsConst(bombs)) {
+ for (Bomb *bomb : std::as_const(bombs)) {
// make sure to not go into onBombExecutionFinished
bomb->disconnect(this);
bomb->destroy();