startAnimation() needs to be called if the layout geometry() changes as well

otherwise the updated layout doesn't take effect. This means that it really
does need to be called from relayout(). So to prevent a quasi-infinite loop,
don't restart the timeline if it's already running.

This fixes the tasks geometry not updating correctly when applets are added
to the panel.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=754148
This commit is contained in:
Jason Stubbs 2007-12-29 07:14:21 +00:00
parent 9cec9edf9c
commit cb9747382b
3 changed files with 7 additions and 8 deletions

View File

@ -309,7 +309,6 @@ void BoxLayout::insertItem(int index, LayoutItem *item)
}
updateGeometry();
startAnimation();
}
void BoxLayout::addItem(LayoutItem *item)
@ -335,7 +334,6 @@ void BoxLayout::removeItem(LayoutItem *item)
}
updateGeometry();
startAnimation();
}
int BoxLayout::indexOf(LayoutItem *l) const
@ -359,8 +357,7 @@ LayoutItem *BoxLayout::takeAt(int i)
}
return d->children.takeAt(i);
// FIXME: This is never reached. Should it be called? Should
// startAnimation() also be called?
// FIXME: This is never reached. Should it be called?
updateGeometry();
}
@ -446,6 +443,8 @@ void BoxLayout::relayout()
pos = d->layoutItem(margined, d->children[i], pos , sizes[i]);
}
startAnimation();
}

View File

@ -69,7 +69,6 @@ void FlowLayout::addItem(LayoutItem* item)
}
updateGeometry();
startAnimation();
}
void FlowLayout::removeItem(LayoutItem* item)
{
@ -85,7 +84,6 @@ void FlowLayout::removeItem(LayoutItem* item)
}
updateGeometry();
startAnimation();
}
int FlowLayout::indexOf(LayoutItem* item) const
{
@ -124,7 +122,7 @@ LayoutItem* FlowLayout::takeAt(int i)
}
return d->items.takeAt(i);
// FIXME: Should updateGeometry() and startAnimation() be called?
// FIXME: Should updateGeometry() be called?
}
template <class T>
@ -221,6 +219,8 @@ void FlowLayout::relayout()
else
item->setGeometry( newGeometry );
}
startAnimation();
}
Qt::Orientations FlowLayout::expandingDirections() const

View File

@ -225,8 +225,8 @@ QSizeF Layout::maximumSize() const
void Layout::startAnimation()
{
if (animator() && animator()->timeLine()) {
animator()->timeLine()->setCurrentTime(0);
if (animator()->timeLine()->state() == QTimeLine::NotRunning) {
animator()->timeLine()->setCurrentTime(0);
animator()->timeLine()->start();
}
}