diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2022-09-30 14:09:04 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-04 07:40:08 +0200 |
| commit | df9d882d41b741fef7c5beeddb0abe9d904443d8 (patch) | |
| tree | 6f3e90dacad4581b7f1cabe235cca298833a3da4 /src/corelib/animation/qabstractanimation.cpp | |
| parent | 109e088c7c5d0c9325966e88d55fd9f7a58f67ea (diff) | |
Port from container.count()/length() to size()
This is semantic patch using ClangTidyTransformator:
auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)
makeRule(cxxMemberCallExpr(on(QtContainerClass),
callee(cxxMethodDecl(hasAnyName({"count", "length"),
parameterCountIs(0))))),
changeTo(cat(access(o, cat("size"), "()"))),
cat("use 'size()' instead of 'count()/length()'"))
a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'.
<classes> are:
// sequential:
"QByteArray",
"QList",
"QQueue",
"QStack",
"QString",
"QVarLengthArray",
"QVector",
// associative:
"QHash",
"QMultiHash",
"QMap",
"QMultiMap",
"QSet",
// Qt has no QMultiSet
Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/animation/qabstractanimation.cpp')
| -rw-r--r-- | src/corelib/animation/qabstractanimation.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index d57ce4ef5f5..46ed60d6d12 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -283,7 +283,7 @@ void QUnifiedTimer::updateAnimationTimers() QScopedValueRollback<bool> guard(insideTick, true); if (profilerCallback) profilerCallback(delta); - for (currentAnimationIdx = 0; currentAnimationIdx < animationTimers.count(); ++currentAnimationIdx) { + for (currentAnimationIdx = 0; currentAnimationIdx < animationTimers.size(); ++currentAnimationIdx) { QAbstractAnimationTimer *animation = animationTimers.at(currentAnimationIdx); animation->updateAnimationsTime(delta); } @@ -294,7 +294,7 @@ void QUnifiedTimer::updateAnimationTimers() int QUnifiedTimer::runningAnimationCount() { int count = 0; - for (int i = 0; i < animationTimers.count(); ++i) + for (int i = 0; i < animationTimers.size(); ++i) count += animationTimers.at(i)->runningAnimationCount(); return count; } @@ -309,7 +309,7 @@ void QUnifiedTimer::localRestart() if (insideRestart) return; - if (!pausedAnimationTimers.isEmpty() && (animationTimers.count() + animationTimersToStart.count() == pausedAnimationTimers.count())) { + if (!pausedAnimationTimers.isEmpty() && (animationTimers.size() + animationTimersToStart.size() == pausedAnimationTimers.size())) { driver->stop(); int closestTimeToFinish = closestPausedAnimationTimerTimeToFinish(); // use a precise timer if the pause will be short @@ -327,7 +327,7 @@ void QUnifiedTimer::restart() { { QScopedValueRollback<bool> guard(insideRestart, true); - for (int i = 0; i < animationTimers.count(); ++i) + for (int i = 0; i < animationTimers.size(); ++i) animationTimers.at(i)->restartAnimationTimer(); } @@ -568,7 +568,7 @@ void QAnimationTimer::updateAnimationsTime(qint64 delta) //when the CPU load is high if (delta) { QScopedValueRollback<bool> guard(insideTick, true); - for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) { + for (currentAnimationIdx = 0; currentAnimationIdx < animations.size(); ++currentAnimationIdx) { QAbstractAnimation *animation = animations.at(currentAnimationIdx); int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime + (animation->direction() == QAbstractAnimation::Forward ? delta : -delta); |
