From 663feaa341b5b944b803268ab9540a27cdf1c3fe Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 31 Aug 2009 00:47:24 +0000 Subject: [PATCH] restore fade in/out svn path=/trunk/KDE/kdelibs/; revision=1017614 --- widgets/itembackground.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/widgets/itembackground.cpp b/widgets/itembackground.cpp index 01d5ae095..022cdba1b 100644 --- a/widgets/itembackground.cpp +++ b/widgets/itembackground.cpp @@ -43,6 +43,7 @@ public: qreal opacity; bool fading; bool fadeIn; + bool immediate; }; ItemBackground::ItemBackground(QGraphicsWidget *parent) @@ -54,6 +55,7 @@ ItemBackground::ItemBackground(QGraphicsWidget *parent) d->opacity = 1; d->fading = false; d->fadeIn = false; + d->immediate = false; setContentsMargins(0, 0, 0, 0); d->frameSvg->setImagePath("widgets/viewitem"); @@ -105,6 +107,10 @@ void ItemBackground::setTargetItem(QGraphicsItem *target) QVariant ItemBackground::itemChange(GraphicsItemChange change, const QVariant &value) { + if (d->immediate) { + return value; + } + if (change == ItemVisibleChange) { bool visible = value.toBool(); bool retVisible = visible; @@ -156,7 +162,9 @@ void ItemBackground::animationUpdate(qreal progress) if (d->fading) { d->opacity = d->fadeIn?progress:1-progress; if (!d->fadeIn && qFuzzyCompare(d->opacity+1, (qreal)1.0)) { + d->immediate = true; hide(); + d->immediate = false; } } else { setGeometry(d->oldGeometry.x() + (d->newGeometry.x() - d->oldGeometry.x()) * progress,