always stop the anim, but only if we have one going on

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=677807
This commit is contained in:
Aaron J. Seigo 2007-06-19 22:48:42 +00:00
parent 9fab210d65
commit b2da6b36ac

View File

@ -425,6 +425,10 @@ void Icon::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
QRectF button1(6, 6, 32, 32); // The top-left circle QRectF button1(6, 6, 32, 32); // The top-left circle
d->button1Hovered = button1.contains(event->pos()); d->button1Hovered = button1.contains(event->pos());
if (d->button1AnimId) {
Phase::self()->stopElementAnimation(d->button1AnimId);
}
d->button1AnimId = Phase::self()->startElementAnimation(this, Phase::ElementAppear); d->button1AnimId = Phase::self()->startElementAnimation(this, Phase::ElementAppear);
Phase::self()->setAnimationPixmap(d->button1AnimId, buttonPixmap()); Phase::self()->setAnimationPixmap(d->button1AnimId, buttonPixmap());
QGraphicsItem::hoverEnterEvent(event); QGraphicsItem::hoverEnterEvent(event);
@ -434,7 +438,11 @@ void Icon::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
d->button1Pressed = false; d->button1Pressed = false;
d->button1Hovered = false; d->button1Hovered = false;
Phase::self()->stopElementAnimation(d->button1AnimId);
if (d->button1AnimId) {
Phase::self()->stopElementAnimation(d->button1AnimId);
}
d->button1AnimId = Phase::self()->startElementAnimation(this, Phase::ElementDisappear); d->button1AnimId = Phase::self()->startElementAnimation(this, Phase::ElementDisappear);
Phase::self()->setAnimationPixmap(d->button1AnimId, buttonPixmap()); Phase::self()->setAnimationPixmap(d->button1AnimId, buttonPixmap());