本文整理汇总了C++中QAbstractAnimation::direction方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractAnimation::direction方法的具体用法?C++ QAbstractAnimation::direction怎么用?C++ QAbstractAnimation::direction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractAnimation
的用法示例。
在下文中一共展示了QAbstractAnimation::direction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateAnimationsTime
void QUnifiedTimer::updateAnimationsTime()
{
//setCurrentTime can get this called again while we're the for loop. At least with pauseAnimations
if(insideTick)
return;
qint64 totalElapsed = time.elapsed();
// ignore consistentTiming in case the pause timer is active
int delta = (consistentTiming && !isPauseTimerActive) ?
timingInterval : totalElapsed - lastTick;
if (slowMode) {
if (slowdownFactor > 0)
delta = qRound(delta / slowdownFactor);
else
delta = 0;
}
lastTick = totalElapsed;
//we make sure we only call update time if the time has actually changed
//it might happen in some cases that the time doesn't change because events are delayed
//when the CPU load is high
if (delta) {
insideTick = true;
for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) {
QAbstractAnimation *animation = animations.at(currentAnimationIdx);
int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime
+ (animation->direction() == QAbstractAnimation::Forward ? delta : -delta);
animation->setCurrentTime(elapsed);
}
insideTick = false;
currentAnimationIdx = 0;
}
}
示例2: closestPauseAnimationTimeToFinish
int QAnimationTimer::closestPauseAnimationTimeToFinish()
{
int closestTimeToFinish = INT_MAX;
for (int i = 0; i < runningPauseAnimations.size(); ++i) {
QAbstractAnimation *animation = runningPauseAnimations.at(i);
int timeToFinish;
if (animation->direction() == QAbstractAnimation::Forward)
timeToFinish = animation->duration() - animation->currentLoopTime();
else
timeToFinish = animation->currentLoopTime();
if (timeToFinish < closestTimeToFinish)
closestTimeToFinish = timeToFinish;
}
return closestTimeToFinish;
}
示例3: updateAnimationsTime
void QUnifiedTimer::updateAnimationsTime()
{
// ignore consistentTiming in case the pause timer is active
int delta = (consistentTiming && !isPauseTimerActive) ?
timingInterval : time.elapsed() - lastTick;
if (slowMode)
delta /= 5;
lastTick = time.elapsed();
//we make sure we only call update time if the time has actually changed
//it might happen in some cases that the time doesn't change because events are delayed
//when the CPU load is high
if (delta) {
for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) {
QAbstractAnimation *animation = animations.at(currentAnimationIdx);
int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime
+ (animation->direction() == QAbstractAnimation::Forward ? delta : -delta);
animation->setCurrentTime(elapsed);
}
currentAnimationIdx = 0;
}
}
示例4: updateAnimationsTime
void QAnimationTimer::updateAnimationsTime(qint64 delta)
{
//setCurrentTime can get this called again while we're the for loop. At least with pauseAnimations
if (insideTick)
return;
lastTick += delta;
//we make sure we only call update time if the time has actually changed
//it might happen in some cases that the time doesn't change because events are delayed
//when the CPU load is high
if (delta) {
insideTick = true;
for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) {
QAbstractAnimation *animation = animations.at(currentAnimationIdx);
int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime
+ (animation->direction() == QAbstractAnimation::Forward ? delta : -delta);
animation->setCurrentTime(elapsed);
}
insideTick = false;
currentAnimationIdx = 0;
}
}