Migration from int to qsizetype of QAnimationGroup

QAnimationGroup, QAnimationGroupPrivate uses now qsizetype instead of the int.

Task-number: QTBUG-103530
Change-Id: I96053a609bc4fad32adce5616eef1af9a86f4e27
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 30344aaa49ec495912fc6ce1fd9aa9bbc8585521)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Konrad Kujawa 2022-08-25 13:18:39 +02:00 committed by Qt Cherry-pick Bot
parent 0c8335575a
commit 6cde2907d2
6 changed files with 13 additions and 13 deletions

View File

@ -186,7 +186,7 @@ void QAnimationGroup::removeAnimation(QAbstractAnimation *animation)
qWarning("QAnimationGroup::remove: cannot remove null animation"); qWarning("QAnimationGroup::remove: cannot remove null animation");
return; return;
} }
int index = d->animations.indexOf(animation); qsizetype index = d->animations.indexOf(animation);
if (index == -1) { if (index == -1) {
qWarning("QAnimationGroup::remove: animation is not part of this group"); qWarning("QAnimationGroup::remove: animation is not part of this group");
return; return;
@ -261,7 +261,7 @@ void QAnimationGroupPrivate::clear(bool onDestruction)
const QList<QAbstractAnimation *> animationsCopy = animations; // taking a copy const QList<QAbstractAnimation *> animationsCopy = animations; // taking a copy
animations.clear(); animations.clear();
// Clearing backwards so the indices doesn't change while we remove animations. // Clearing backwards so the indices doesn't change while we remove animations.
for (int i = animationsCopy.size() - 1; i >= 0; --i) { for (qsizetype i = animationsCopy.size() - 1; i >= 0; --i) {
QAbstractAnimation *animation = animationsCopy.at(i); QAbstractAnimation *animation = animationsCopy.at(i);
animation->setParent(nullptr); animation->setParent(nullptr);
QAbstractAnimationPrivate::get(animation)->group = nullptr; QAbstractAnimationPrivate::get(animation)->group = nullptr;
@ -275,7 +275,7 @@ void QAnimationGroupPrivate::clear(bool onDestruction)
} }
} }
void QAnimationGroupPrivate::animationRemoved(int index, QAbstractAnimation *) void QAnimationGroupPrivate::animationRemoved(qsizetype index, QAbstractAnimation *)
{ {
Q_Q(QAnimationGroup); Q_Q(QAnimationGroup);
Q_UNUSED(index); Q_UNUSED(index);

View File

@ -34,8 +34,8 @@ public:
isGroup = true; isGroup = true;
} }
virtual void animationInsertedAt(int) { } virtual void animationInsertedAt(qsizetype) { }
virtual void animationRemoved(int, QAbstractAnimation *); virtual void animationRemoved(qsizetype, QAbstractAnimation *);
void clear(bool onDestruction); void clear(bool onDestruction);

View File

@ -255,7 +255,7 @@ bool QParallelAnimationGroupPrivate::isUncontrolledAnimationFinished(QAbstractAn
return uncontrolledFinishTime.value(anim, -1) >= 0; return uncontrolledFinishTime.value(anim, -1) >= 0;
} }
void QParallelAnimationGroupPrivate::animationRemoved(int index, QAbstractAnimation *anim) void QParallelAnimationGroupPrivate::animationRemoved(qsizetype index, QAbstractAnimation *anim)
{ {
QAnimationGroupPrivate::animationRemoved(index, anim); QAnimationGroupPrivate::animationRemoved(index, anim);
disconnectUncontrolledAnimation(anim); disconnectUncontrolledAnimation(anim);

View File

@ -42,7 +42,7 @@ public:
void connectUncontrolledAnimations(); void connectUncontrolledAnimations();
void disconnectUncontrolledAnimations(); void disconnectUncontrolledAnimations();
void animationRemoved(int index, QAbstractAnimation *) override; void animationRemoved(qsizetype index, QAbstractAnimation *) override;
// private slot // private slot
void _q_uncontrolledAnimationFinished(); void _q_uncontrolledAnimationFinished();

View File

@ -472,7 +472,7 @@ void QSequentialAnimationGroupPrivate::_q_uncontrolledAnimationFinished()
the group at index \a index. the group at index \a index.
Note: We only support insertion after the current animation Note: We only support insertion after the current animation
*/ */
void QSequentialAnimationGroupPrivate::animationInsertedAt(int index) void QSequentialAnimationGroupPrivate::animationInsertedAt(qsizetype index)
{ {
if (currentAnimation == nullptr) { if (currentAnimation == nullptr) {
setCurrentAnimation(0); // initialize the current animation setCurrentAnimation(0); // initialize the current animation
@ -500,7 +500,7 @@ void QSequentialAnimationGroupPrivate::animationInsertedAt(int index)
the group at index \a index. The animation is no more listed when this the group at index \a index. The animation is no more listed when this
method is called. method is called.
*/ */
void QSequentialAnimationGroupPrivate::animationRemoved(int index, QAbstractAnimation *anim) void QSequentialAnimationGroupPrivate::animationRemoved(qsizetype index, QAbstractAnimation *anim)
{ {
Q_Q(QSequentialAnimationGroup); Q_Q(QSequentialAnimationGroup);
QAnimationGroupPrivate::animationRemoved(index, anim); QAnimationGroupPrivate::animationRemoved(index, anim);
@ -511,7 +511,7 @@ void QSequentialAnimationGroupPrivate::animationRemoved(int index, QAbstractAnim
if (actualDuration.size() > index) if (actualDuration.size() > index)
actualDuration.removeAt(index); actualDuration.removeAt(index);
const int currentIndex = animations.indexOf(currentAnimation); const qsizetype currentIndex = animations.indexOf(currentAnimation);
if (currentIndex == -1) { if (currentIndex == -1) {
//we're removing the current animation //we're removing the current animation
@ -529,7 +529,7 @@ void QSequentialAnimationGroupPrivate::animationRemoved(int index, QAbstractAnim
// duration of the previous animations up to the current animation // duration of the previous animations up to the current animation
currentTime = 0; currentTime = 0;
for (int i = 0; i < currentAnimationIndex; ++i) { for (qsizetype i = 0; i < currentAnimationIndex; ++i) {
const int current = animationActualTotalDuration(i); const int current = animationActualTotalDuration(i);
currentTime += current; currentTime += current;
} }

View File

@ -44,8 +44,8 @@ public:
void setCurrentAnimation(int index, bool intermediate = false); void setCurrentAnimation(int index, bool intermediate = false);
void activateCurrentAnimation(bool intermediate = false); void activateCurrentAnimation(bool intermediate = false);
void animationInsertedAt(int index) override; void animationInsertedAt(qsizetype index) override;
void animationRemoved(int index, QAbstractAnimation *anim) override; void animationRemoved(qsizetype index, QAbstractAnimation *anim) override;
bool atEnd() const; bool atEnd() const;