Move duplicated animation starting code into Layout::startAnimation() which layout subclasses can call at the end of their setGeometry() implementation to start the layout animator's timer.
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=707803
This commit is contained in:
parent
ecd23d6e67
commit
15fbaba2ac
@ -438,12 +438,7 @@ void BoxLayout::setGeometry(const QRectF& geo)
|
||||
|
||||
d->geometry = geometry;
|
||||
|
||||
if ( animator() && animator()->timeLine() ) {
|
||||
animator()->timeLine()->setCurrentTime(0);
|
||||
if ( animator()->timeLine()->state() == QTimeLine::NotRunning ) {
|
||||
animator()->timeLine()->start();
|
||||
}
|
||||
}
|
||||
startAnimation();
|
||||
}
|
||||
|
||||
|
||||
|
@ -193,8 +193,7 @@ void FlowLayout::setGeometry(const QRectF& geo)
|
||||
|
||||
d->geometry = geo;
|
||||
|
||||
if ( animator() && animator()->timeLine() )
|
||||
animator()->timeLine()->start();
|
||||
startAnimation();
|
||||
}
|
||||
|
||||
Qt::Orientations FlowLayout::expandingDirections() const
|
||||
|
@ -21,9 +21,11 @@
|
||||
#include <math.h>
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QTimeLine>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "widget.h"
|
||||
#include "layoutanimator.h"
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
@ -146,5 +148,14 @@ QSizeF Layout::maximumSize() const
|
||||
{
|
||||
return QSizeF(INFINITY,INFINITY);
|
||||
}
|
||||
void Layout::startAnimation()
|
||||
{
|
||||
if ( animator() && animator()->timeLine() ) {
|
||||
animator()->timeLine()->setCurrentTime(0);
|
||||
if ( animator()->timeLine()->state() == QTimeLine::NotRunning ) {
|
||||
animator()->timeLine()->start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -152,6 +152,16 @@ class PLASMA_EXPORT Layout : public LayoutItem
|
||||
/** TODO Document me */
|
||||
void invalidate();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Starts a layout animation. Subclasses may call this
|
||||
* at the end of their setGeometry() implementation to
|
||||
* start the timeline associated with the layout's animator()
|
||||
* if there is one. If an animation is already in progress then
|
||||
* the timeline is reset to 0ms and the animation continues.
|
||||
*/
|
||||
void startAnimation();
|
||||
|
||||
private:
|
||||
class Private;
|
||||
Private *const d;
|
||||
|
Loading…
Reference in New Issue
Block a user