summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qstyleanimation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/styles/qstyleanimation.cpp')
-rw-r--r--src/widgets/styles/qstyleanimation.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp
index 6668be8307..65d011f01f 100644
--- a/src/widgets/styles/qstyleanimation.cpp
+++ b/src/widgets/styles/qstyleanimation.cpp
@@ -53,7 +53,7 @@ static const qreal ScrollBarFadeOutDuration = 200.0;
static const qreal ScrollBarFadeOutDelay = 450.0;
QStyleAnimation::QStyleAnimation(QObject *target) : QAbstractAnimation(target),
- _delay(0), _duration(-1), _startTime(QTime::currentTime())
+ _delay(0), _duration(-1), _startTime(QTime::currentTime()), _fps(ThirtyFps), _skip(0)
{
}
@@ -96,6 +96,16 @@ void QStyleAnimation::setStartTime(const QTime &time)
_startTime = time;
}
+QStyleAnimation::FrameRate QStyleAnimation::frameRate() const
+{
+ return _fps;
+}
+
+void QStyleAnimation::setFrameRate(FrameRate fps)
+{
+ _fps = fps;
+}
+
void QStyleAnimation::updateTarget()
{
QEvent event(QEvent::StyleAnimationUpdate);
@@ -105,6 +115,12 @@ void QStyleAnimation::updateTarget()
stop();
}
+void QStyleAnimation::start()
+{
+ _skip = 0;
+ QAbstractAnimation::start(DeleteWhenStopped);
+}
+
bool QStyleAnimation::isUpdateNeeded() const
{
return currentTime() > _delay;
@@ -112,8 +128,11 @@ bool QStyleAnimation::isUpdateNeeded() const
void QStyleAnimation::updateCurrentTime(int)
{
- if (target() && isUpdateNeeded())
- updateTarget();
+ if (++_skip >= _fps) {
+ _skip = 0;
+ if (target() && isUpdateNeeded())
+ updateTarget();
+ }
}
QProgressStyleAnimation::QProgressStyleAnimation(int speed, QObject *target) :