Converting FadeAnimation and adding some todos: we must use qreal
since it is a typedef that falls back to float/double depending on the cpu. svn path=/trunk/KDE/kdelibs/; revision=1036741
This commit is contained in:
parent
6142e913f6
commit
7ccf35e9fd
@ -18,24 +18,24 @@
|
||||
*/
|
||||
|
||||
#include "fade.h"
|
||||
#include "private/animationprivate_p.h"
|
||||
|
||||
#include <QRect>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
FadeAnimation::FadeAnimation(double factor)
|
||||
: m_factor(factor)
|
||||
{
|
||||
|
||||
if (m_factor > 1.0){
|
||||
AnimationPrivate *obj = getAnimationPrivate();
|
||||
obj->animFactor = factor;
|
||||
if (obj->animFactor > 1.0) {
|
||||
kDebug() << "Opacity must be between 0 and 1.0. Reducing to 1.0.";
|
||||
m_factor = 1.0;
|
||||
} else if(m_factor < 0){
|
||||
obj->animFactor = 1.0;
|
||||
} else if (obj->animFactor < 0) {
|
||||
kDebug() << "Opacity must be between 0 and 1.0. Increasing to 0.";
|
||||
m_factor = 0;
|
||||
obj->animFactor = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ QAbstractAnimation* FadeAnimation::render(QObject* parent){
|
||||
//create animation
|
||||
QGraphicsWidget *m_object = getAnimatedObject();
|
||||
QPropertyAnimation* anim = new QPropertyAnimation(m_object, "opacity", parent);
|
||||
anim->setEndValue(m_factor);
|
||||
anim->setEndValue(getAnimationPrivate()->animFactor);
|
||||
anim->setDuration(getDuration());
|
||||
|
||||
//QObject::connect(anim, SIGNAL(finished()), anim, SLOT(deleteLater()));
|
||||
|
@ -41,15 +41,13 @@ class PLASMA_EXPORT FadeAnimation : public Animation
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/* TODO: convert to qreal */
|
||||
FadeAnimation(double factor);
|
||||
virtual ~FadeAnimation(){};
|
||||
|
||||
protected:
|
||||
virtual QAbstractAnimation* render(QObject* parent = 0);
|
||||
|
||||
private:
|
||||
qreal m_factor;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ class PLASMA_EXPORT GrowAnimation : public Animation
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/* TODO: convert to qreal */
|
||||
GrowAnimation(double factor);
|
||||
virtual ~GrowAnimation(){};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user