summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2012-10-22 19:15:14 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-23 12:51:41 +0200
commit4835a87fe3a4107a7d7a05b371d8a2a4b3b255de (patch)
treeeae35b625405715cb932c2251a82e435dd0af38d /src/widgets
parentee0dbed4db618ed1156be5c5fae133e6ebd7bc4c (diff)
Add QStyleAnimation::updateTarget()
For example a paused "default button" animation might want to update the target to get "non-default button" looks meanwhile the animation is paused. Change-Id: Ibb854a40f38a8971e7233b1f34a83056e6a9d827 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/styles/qstyleanimation.cpp12
-rw-r--r--src/widgets/styles/qstyleanimation_p.h2
2 files changed, 10 insertions, 4 deletions
diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp
index 9f58c9d51f..6b12ca9540 100644
--- a/src/widgets/styles/qstyleanimation.cpp
+++ b/src/widgets/styles/qstyleanimation.cpp
@@ -81,6 +81,12 @@ void QStyleAnimation::setStartTime(const QTime &time)
_startTime = time;
}
+void QStyleAnimation::updateTarget()
+{
+ QEvent event(QEvent::StyleAnimationUpdate);
+ QCoreApplication::sendEvent(target(), &event);
+}
+
bool QStyleAnimation::isUpdateNeeded() const
{
return true;
@@ -95,10 +101,8 @@ void QStyleAnimation::updateCurrentTime(int)
stop();
}
- if (isUpdateNeeded()) {
- QEvent event(QEvent::StyleAnimationUpdate);
- QCoreApplication::sendEvent(tgt, &event);
- }
+ if (isUpdateNeeded())
+ updateTarget();
}
}
diff --git a/src/widgets/styles/qstyleanimation_p.h b/src/widgets/styles/qstyleanimation_p.h
index 8231abbb40..577b1d7dd4 100644
--- a/src/widgets/styles/qstyleanimation_p.h
+++ b/src/widgets/styles/qstyleanimation_p.h
@@ -72,6 +72,8 @@ public:
QTime startTime() const;
void setStartTime(const QTime &time);
+ void updateTarget();
+
protected:
virtual bool isUpdateNeeded() const;
virtual void updateCurrentTime(int time);