Workaround for deforming animated widget if a new pulse event

was triggered while the animation was running and *before*
it was over.

For while, it will just ignore the geometry calculus and return
(but ideally it should listen for the event emited when the animation
is over and then recalculate the geometries).


svn path=/trunk/KDE/kdelibs/; revision=1039630
This commit is contained in:
Adenilson Cavalcanti Da Silva 2009-10-24 03:04:17 +00:00
parent 1049afdab6
commit c18c6188e3

View File

@ -142,14 +142,26 @@ void PulseAnimation::createAnimation(qreal duration, qreal scale)
dirty = true;
} else {
*(d->pulseGeometry) = d->under->geometry();
d->opacityAnimation->setEndValue(0);
QRectF initial(d->under->geometry());
qreal W = initial.width() * scale * 0.33;
qreal H = initial.height() * scale * 0.33;
QRectF end(initial.x() - W, initial.y() - H, initial.width() * scale,
initial.height() * scale);
d->geometryAnimation->setEndValue(end);
/* Stop the animation or the widget will be deformed.
*/
QAbstractAnimation::State temp = anim->state();
if (temp == QAbstractAnimation::Running) {
anim->stop();
/* TODO: will need to watch stateChanged signal
* and *then* reset the geometry
*/
} else {
/* TODO: move this to a function */
*(d->pulseGeometry) = d->under->geometry();
d->opacityAnimation->setEndValue(0);
QRectF initial(d->under->geometry());
qreal W = initial.width() * scale * 0.33;
qreal H = initial.height() * scale * 0.33;
QRectF end(initial.x() - W, initial.y() - H, initial.width() * scale,
initial.height() * scale);
d->geometryAnimation->setEndValue(end);
}
}