本文整理汇总了C++中QAbstractAnimation::setDirection方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractAnimation::setDirection方法的具体用法?C++ QAbstractAnimation::setDirection怎么用?C++ QAbstractAnimation::setDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractAnimation
的用法示例。
在下文中一共展示了QAbstractAnimation::setDirection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateState
/*!
\reimp
*/
void QParallelAnimationGroup::updateState(QAbstractAnimation::State newState,
QAbstractAnimation::State oldState)
{
Q_D(QParallelAnimationGroup);
QAnimationGroup::updateState(newState, oldState);
switch (newState) {
case Stopped:
for (int i = 0; i < d->animations.size(); ++i)
d->animations.at(i)->stop();
d->disconnectUncontrolledAnimations();
break;
case Paused:
for (int i = 0; i < d->animations.size(); ++i)
if (d->animations.at(i)->state() == Running)
d->animations.at(i)->pause();
break;
case Running:
d->connectUncontrolledAnimations();
for (int i = 0; i < d->animations.size(); ++i) {
QAbstractAnimation *animation = d->animations.at(i);
if (oldState == Stopped)
animation->stop();
animation->setDirection(d->direction);
if (d->shouldAnimationStart(animation, oldState == Stopped))
animation->start();
}
break;
}
}
示例2: updateDirection
/*!
\reimp
*/
void QParallelAnimationGroup::updateDirection(QAbstractAnimation::Direction direction)
{
Q_D(QParallelAnimationGroup);
//we need to update the direction of the current animation
if (state() != Stopped) {
for (int i = 0; i < d->animations.size(); ++i) {
QAbstractAnimation *animation = d->animations.at(i);
animation->setDirection(direction);
}
} else {
if (direction == Forward) {
d->lastLoop = 0;
d->lastCurrentTime = 0;
} else {
// Looping backwards with loopCount == -1 does not really work well...
d->lastLoop = (d->loopCount == -1 ? 0 : d->loopCount - 1);
d->lastCurrentTime = duration();
}
}
}