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
This commit is contained in:
Adenilson Cavalcanti Da Silva 2009-11-17 22:53:08 +00:00
parent 2bfcef80ab
commit acda971fa0
2 changed files with 8 additions and 10 deletions

View File

@ -82,6 +82,8 @@ void PulseAnimation::setCopy()
ShadowFake *shadow = 0;
if (!d->under)
shadow = new ShadowFake;
else
shadow = dynamic_cast<ShadowFake*>(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);

View File

@ -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());