QStyleAnimation: fix threaded rendering

Change-Id: I00875adf2e4b157a3f8b0b99e5280b1275635026
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
This commit is contained in:
J-P Nurmi 2012-10-23 10:53:40 +02:00 committed by The Qt Project
parent 2e21332476
commit 7abf623443
2 changed files with 7 additions and 5 deletions

View File

@ -1073,7 +1073,6 @@ void QCommonStylePrivate::startAnimation(QStyleAnimation *animation) const
{
Q_Q(const QCommonStyle);
stopAnimation(animation->target());
q->connect(animation, SIGNAL(finished()), SLOT(_q_removeAnimation()), Qt::UniqueConnection);
q->connect(animation, SIGNAL(destroyed()), SLOT(_q_removeAnimation()), Qt::UniqueConnection);
animations.insert(animation->target(), animation);
animation->start();
@ -1096,10 +1095,8 @@ void QCommonStylePrivate::_q_removeAnimation()
{
Q_Q(QCommonStyle);
QObject *animation = q->sender();
if (animation) {
if (animation)
animations.remove(animation->parent());
animation->deleteLater();
}
}
/*!

View File

@ -47,9 +47,14 @@
QT_BEGIN_NAMESPACE
QStyleAnimation::QStyleAnimation(QObject *target) : QAbstractAnimation(target),
QStyleAnimation::QStyleAnimation(QObject *target) : QAbstractAnimation(),
_startTime(QTime::currentTime())
{
if (target) {
moveToThread(target->thread());
setParent(target);
}
connect(this, SIGNAL(finished()), SLOT(deleteLater()));
}
QStyleAnimation::~QStyleAnimation()