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>
This commit is contained in:
parent
ee0dbed4db
commit
4835a87fe3
@ -81,6 +81,12 @@ void QStyleAnimation::setStartTime(const QTime &time)
|
|||||||
_startTime = time;
|
_startTime = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QStyleAnimation::updateTarget()
|
||||||
|
{
|
||||||
|
QEvent event(QEvent::StyleAnimationUpdate);
|
||||||
|
QCoreApplication::sendEvent(target(), &event);
|
||||||
|
}
|
||||||
|
|
||||||
bool QStyleAnimation::isUpdateNeeded() const
|
bool QStyleAnimation::isUpdateNeeded() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -95,10 +101,8 @@ void QStyleAnimation::updateCurrentTime(int)
|
|||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isUpdateNeeded()) {
|
if (isUpdateNeeded())
|
||||||
QEvent event(QEvent::StyleAnimationUpdate);
|
updateTarget();
|
||||||
QCoreApplication::sendEvent(tgt, &event);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +72,8 @@ public:
|
|||||||
QTime startTime() const;
|
QTime startTime() const;
|
||||||
void setStartTime(const QTime &time);
|
void setStartTime(const QTime &time);
|
||||||
|
|
||||||
|
void updateTarget();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool isUpdateNeeded() const;
|
virtual bool isUpdateNeeded() const;
|
||||||
virtual void updateCurrentTime(int time);
|
virtual void updateCurrentTime(int time);
|
||||||
|
Loading…
Reference in New Issue
Block a user