Migration from int to qsizetype of QAnimationGroup

QAnimationGroup, QAnimationGroupPrivate uses now qsizetype instead of the int.

Task-number: QTBUG-103530
Pick-to: 6.5
Change-Id: I96053a609bc4fad32adce5616eef1af9a86f4e27
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Konrad Kujawa 2022-08-25 13:18:39 +02:00
parent 4c445ef0ba
commit 30344aaa49
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");
return;
}
int index = d->animations.indexOf(animation);
qsizetype index = d->animations.indexOf(animation);
if (index == -1) {
qWarning("QAnimationGroup::remove: animation is not part of this group");
return;
@ -261,7 +261,7 @@ void QAnimationGroupPrivate::clear(bool onDestruction)
const QList<QAbstractAnimation *> animationsCopy = animations; // taking a copy
animations.clear();
// 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);
animation->setParent(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_UNUSED(index);

View File

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

View File

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

View File

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

View File

@ -472,7 +472,7 @@ void QSequentialAnimationGroupPrivate::_q_uncontrolledAnimationFinished()
the group at index \a index.
Note: We only support insertion after the current animation
*/
void QSequentialAnimationGroupPrivate::animationInsertedAt(int index)
void QSequentialAnimationGroupPrivate::animationInsertedAt(qsizetype index)
{
if (currentAnimation == nullptr) {
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
method is called.
*/
void QSequentialAnimationGroupPrivate::animationRemoved(int index, QAbstractAnimation *anim)
void QSequentialAnimationGroupPrivate::animationRemoved(qsizetype index, QAbstractAnimation *anim)
{
Q_Q(QSequentialAnimationGroup);
QAnimationGroupPrivate::animationRemoved(index, anim);
@ -511,7 +511,7 @@ void QSequentialAnimationGroupPrivate::animationRemoved(int index, QAbstractAnim
if (actualDuration.size() > index)
actualDuration.removeAt(index);
const int currentIndex = animations.indexOf(currentAnimation);
const qsizetype currentIndex = animations.indexOf(currentAnimation);
if (currentIndex == -1) {
//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
currentTime = 0;
for (int i = 0; i < currentAnimationIndex; ++i) {
for (qsizetype i = 0; i < currentAnimationIndex; ++i) {
const int current = animationActualTotalDuration(i);
currentTime += current;
}

View File

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