if we have a target item and the target is visible but the background item isn't, show the background item and just move it into place

svn path=/trunk/KDE/kdelibs/; revision=1025473
This commit is contained in:
Aaron J. Seigo 2009-09-18 21:24:14 +00:00
parent 1a8d9c1030
commit 2f535d5516

View File

@ -95,7 +95,7 @@ void ItemBackground::setTarget(const QRectF &newGeometry)
d->oldGeometry = geometry(); d->oldGeometry = geometry();
d->newGeometry = newGeometry; d->newGeometry = newGeometry;
if (!isVisible()) { if (!isVisible() && (!d->target || !d->target->isVisible())) {
setGeometry(d->newGeometry); setGeometry(d->newGeometry);
return; return;
} }
@ -109,6 +109,12 @@ void ItemBackground::setTarget(const QRectF &newGeometry)
Plasma::Animator::self()->stopCustomAnimation(d->animId); Plasma::Animator::self()->stopCustomAnimation(d->animId);
} }
if (d->target && d->target->isVisible() && !isVisible()) {
setGeometry(newGeometry);
d->oldGeometry = newGeometry;
show();
}
d->fading = false; d->fading = false;
d->opacity = 1; d->opacity = 1;
d->animId = Plasma::Animator::self()->customAnimation( d->animId = Plasma::Animator::self()->customAnimation(
@ -133,6 +139,8 @@ void ItemBackground::setTargetItem(QGraphicsItem *target)
} }
if (target) { if (target) {
d->target = target;
setZValue(target->zValue() - 1); setZValue(target->zValue() - 1);
setParentItem(target->parentItem()); setParentItem(target->parentItem());
QRectF rect = target->boundingRect(); QRectF rect = target->boundingRect();
@ -140,8 +148,6 @@ void ItemBackground::setTargetItem(QGraphicsItem *target)
setTarget(rect); setTarget(rect);
if (d->target != target) { if (d->target != target) {
d->target = target;
d->target->installSceneEventFilter(this); d->target->installSceneEventFilter(this);
QObject *obj = 0; QObject *obj = 0;
@ -235,7 +241,7 @@ void ItemBackgroundPrivate::animationUpdate(qreal progress)
q->hide(); q->hide();
immediate = false; immediate = false;
} }
} else { } else if (oldGeometry != newGeometry) {
q->setGeometry(oldGeometry.x() + (newGeometry.x() - oldGeometry.x()) * progress, q->setGeometry(oldGeometry.x() + (newGeometry.x() - oldGeometry.x()) * progress,
oldGeometry.y() + (newGeometry.y() - oldGeometry.y()) * progress, oldGeometry.y() + (newGeometry.y() - oldGeometry.y()) * progress,
oldGeometry.width() + (newGeometry.width() - oldGeometry.width()) * progress, oldGeometry.width() + (newGeometry.width() - oldGeometry.width()) * progress,