本文整理汇总了C++中QAbstractAnimation::state方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractAnimation::state方法的具体用法?C++ QAbstractAnimation::state怎么用?C++ QAbstractAnimation::state使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractAnimation
的用法示例。
在下文中一共展示了QAbstractAnimation::state方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateCurrentTime
/*!
\reimp
*/
void QParallelAnimationGroup::updateCurrentTime(int currentTime)
{
Q_D(QParallelAnimationGroup);
if (d->animations.isEmpty())
return;
if (d->currentLoop > d->lastLoop) {
// simulate completion of the loop
int dura = duration();
if (dura > 0) {
for (int i = 0; i < d->animations.size(); ++i) {
QAbstractAnimation *animation = d->animations.at(i);
if (animation->state() != QAbstractAnimation::Stopped)
d->animations.at(i)->setCurrentTime(dura); // will stop
}
}
} else if (d->currentLoop < d->lastLoop) {
// simulate completion of the loop seeking backwards
for (int i = 0; i < d->animations.size(); ++i) {
QAbstractAnimation *animation = d->animations.at(i);
//we need to make sure the animation is in the right state
//and then rewind it
d->applyGroupState(animation);
animation->setCurrentTime(0);
animation->stop();
}
}
#ifdef QANIMATION_DEBUG
qDebug("QParallellAnimationGroup %5d: setCurrentTime(%d), loop:%d, last:%d, timeFwd:%d, lastcurrent:%d, %d",
__LINE__, d->currentTime, d->currentLoop, d->lastLoop, timeFwd, d->lastCurrentTime, state());
#endif
// finally move into the actual time of the current loop
for (int i = 0; i < d->animations.size(); ++i) {
QAbstractAnimation *animation = d->animations.at(i);
const int dura = animation->totalDuration();
//if the loopcount is bigger we should always start all animations
if (d->currentLoop > d->lastLoop
//if we're at the end of the animation, we need to start it if it wasn't already started in this loop
//this happens in Backward direction where not all animations are started at the same time
|| d->shouldAnimationStart(animation, d->lastCurrentTime > dura /*startIfAtEnd*/)) {
d->applyGroupState(animation);
}
if (animation->state() == state()) {
animation->setCurrentTime(currentTime);
if (dura > 0 && currentTime > dura)
animation->stop();
}
}
d->lastLoop = d->currentLoop;
d->lastCurrentTime = currentTime;
}