add Easing Curve Type Property

svn path=/trunk/KDE/kdelibs/; revision=1038000
This commit is contained in:
Igor Trindade Oliveira 2009-10-20 13:08:23 +00:00
parent dd2b126960
commit cbc0f99d2a
3 changed files with 33 additions and 1 deletions

View File

@ -20,13 +20,15 @@
#include "abstractanimation.h" #include "abstractanimation.h"
#include "private/animationprivate_p.h" #include "private/animationprivate_p.h"
#include <QEasingCurve>
namespace Plasma namespace Plasma
{ {
AbstractAnimation::AbstractAnimation(): d(new AnimationPrivate) AbstractAnimation::AbstractAnimation(): d(new AnimationPrivate)
{ {
d->easingCurve = QEasingCurve::Linear;
} }
AbstractAnimation::~AbstractAnimation() AbstractAnimation::~AbstractAnimation()
@ -44,6 +46,16 @@ QGraphicsWidget* AbstractAnimation::getAnimatedObject()
return d->animObject; return d->animObject;
} }
void AbstractAnimation::setEasingCurveType(QEasingCurve::Type easingCurve)
{
d->easingCurve = easingCurve;
}
QEasingCurve::Type AbstractAnimation::easingCurveType() const
{
return d->easingCurve;
}
AnimationPrivate* AbstractAnimation::getAnimationPrivate() AnimationPrivate* AbstractAnimation::getAnimationPrivate()
{ {
return d; return d;

View File

@ -26,12 +26,14 @@
#define PLASMA_ABSTRACTANIMATION_H #define PLASMA_ABSTRACTANIMATION_H
#include <QAbstractAnimation> #include <QAbstractAnimation>
#include <QEasingCurve>
#include <QGraphicsWidget> #include <QGraphicsWidget>
#include <QObject> #include <QObject>
#include <plasma/plasma.h> #include <plasma/plasma.h>
#include <plasma/plasma_export.h> #include <plasma/plasma_export.h>
namespace Plasma namespace Plasma
{ {
@ -44,6 +46,7 @@ class PLASMA_EXPORT AbstractAnimation : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QEasingCurve::Type easingCurveType READ easingCurveType WRITE setEasingCurveType)
public: public:
@ -62,6 +65,16 @@ public:
*/ */
virtual QAbstractAnimation* toQAbstractAnimation(QObject* parent) = 0; virtual QAbstractAnimation* toQAbstractAnimation(QObject* parent) = 0;
/**
* Set the animation easing curve type
*/
void setEasingCurveType(QEasingCurve::Type easingCurve);
/**
* Get the animation easing curve type
*/
QEasingCurve::Type easingCurveType() const;
public slots: public slots:
/** /**

View File

@ -21,6 +21,8 @@
#ifndef PLASMA_ANIMATIONPRIVATE_H #ifndef PLASMA_ANIMATIONPRIVATE_H
#define PLASMA_ANIMATIONPRIVATE_H #define PLASMA_ANIMATIONPRIVATE_H
#include <QEasingCurve>
namespace Plasma namespace Plasma
{ {
@ -55,6 +57,11 @@ public:
*/ */
bool animVisible; bool animVisible;
/**
* Animation easing curve type
*/
QEasingCurve::Type easingCurve;
}; };
} }