From acda971fa03422acadc05ed3399c21afcf4c04a2 Mon Sep 17 00:00:00 2001 From: Adenilson Cavalcanti Da Silva Date: Tue, 17 Nov 2009 22:53:08 +0000 Subject: [PATCH] Set of changes: - moved transformation reference inside of the the shadow pulse class - ensuring that the local pointer in pulser will correctly point to the shadow object - recreating the pixmap if the animated widget geometry has changed svn path=/trunk/KDE/kdelibs/; revision=1050711 --- animations/pulser.cpp | 14 ++++---------- private/pulsershadow.cpp | 4 ++++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/animations/pulser.cpp b/animations/pulser.cpp index fe5eb8759..52491e970 100644 --- a/animations/pulser.cpp +++ b/animations/pulser.cpp @@ -82,6 +82,8 @@ void PulseAnimation::setCopy() ShadowFake *shadow = 0; if (!d->under) shadow = new ShadowFake; + else + shadow = dynamic_cast(d->under); shadow->copyTarget(target); @@ -125,10 +127,6 @@ void PulseAnimation::createAnimation(qreal duration, qreal scale) d->opacityAnimation->setEndValue(0); group->addAnimation(d->opacityAnimation); - QRectF initial(d->under->geometry()); - QPointF tmp(initial.width() * 0.5, initial.height() * 0.5); - d->under->setTransformOriginPoint(tmp); - d->scaleAnimation = new QPropertyAnimation(d->under, "scale"); d->scaleAnimation->setDuration(duration); d->scaleAnimation->setStartValue(d->mscale); @@ -149,12 +147,8 @@ void PulseAnimation::createAnimation(qreal duration, qreal scale) * and *then* reset the geometry */ } else { - if ((*d->pulseGeometry) != widgetToAnimate()->geometry()) { - /*FIXME: it crashes when deleting old the image in ShadowFake - * setCopy(); - */ - qDebug() << "PulseAnimation:: it should update the geom...."; - } + if ((*d->pulseGeometry) != widgetToAnimate()->geometry()) + setCopy(); d->opacityAnimation->setEndValue(0); d->scaleAnimation->setEndValue(scale); diff --git a/private/pulsershadow.cpp b/private/pulsershadow.cpp index ffe94d2e8..895f36812 100644 --- a/private/pulsershadow.cpp +++ b/private/pulsershadow.cpp @@ -38,6 +38,10 @@ ShadowFake::~ShadowFake() void ShadowFake::copyTarget(QGraphicsWidget *target) { + QRectF initial(target->geometry()); + QPointF tmp(initial.width() * 0.5, initial.height() * 0.5); + setTransformOriginPoint(tmp); + setParentItem(target); setGeometry(target->geometry()); QSize size(target->size().toSize());