create properties to rotatestackedanimation

svn path=/trunk/KDE/kdelibs/; revision=1039220
This commit is contained in:
Igor Trindade Oliveira 2009-10-23 02:45:55 +00:00
parent 526fbaf825
commit 2f02dbb602
4 changed files with 29 additions and 18 deletions

View File

@ -1,5 +1,5 @@
/***********************************************************************/
/* stackedlayout.h */
/* rotationstacked.h */
/* */
/* Copyright(C) 2009 Igor Trindade Oliveira <igor.oliveira@indt.org.br>*/
/* */
@ -35,7 +35,7 @@ class RotationStackedAnimationPrivate {
AbstractAnimation::Reference reference;
QPair<QGraphicsWidget *, QGraphicsWidget *> animObjects;
QGraphicsWidget *backWidget;
StackedLayout *sLayout;
};
@ -65,12 +65,19 @@ AbstractAnimation::Reference RotationStackedAnimation::reference()
return d->reference;
}
void RotationStackedAnimation::setWidgetsToAnimate(QGraphicsWidget *front, QGraphicsWidget *back)
QGraphicsWidget *RotationStackedAnimation::backWidget()
{
d->animObjects = qMakePair(front, back);
return d->backWidget;
}
d->sLayout->addWidget(front);
d->sLayout->addWidget(back);
void RotationStackedAnimation::setBackWidget(QGraphicsWidget *backWidget)
{
d->backWidget = backWidget;
if(widgetToAnimate()) {
d->sLayout->addWidget(widgetToAnimate());
d->sLayout->addWidget(backWidget);
}
}
QGraphicsLayoutItem *RotationStackedAnimation::layout()
@ -78,16 +85,11 @@ QGraphicsLayoutItem *RotationStackedAnimation::layout()
return d->sLayout;
}
QPair<QGraphicsWidget *,QGraphicsWidget *> RotationStackedAnimation::widgetsToAnimate()
{
return d->animObjects;
}
QAbstractAnimation *RotationStackedAnimation::render(QObject *parent)
{
Q_UNUSED(parent);
QPair<QGraphicsWidget *,QGraphicsWidget *> widgets = widgetsToAnimate();
QPair<QGraphicsWidget *,QGraphicsWidget *> widgets = qMakePair(widgetToAnimate(), d->backWidget);
QSequentialAnimationGroup *groupAnim = new QSequentialAnimationGroup(parent);

View File

@ -1,5 +1,5 @@
#////////////////////////////////////////////////////////////////////////
// rotation.cpp //
// rotationstacked.h //
// //
// Copyright(C) 2009 Igor Trindade Oliveira <igor.oliveira@indt.org.br>//
// //
@ -25,14 +25,24 @@
#include <plasma/animations/animation.h>
#include <plasma/plasma_export.h>
#include <QGraphicsLayoutItem>
namespace Plasma {
class RotationStackedAnimationPrivate;
/* TODO:
* create a parent class for rotations
*/
class RotationStackedAnimation : public Animation
{
Q_OBJECT
Q_PROPERTY(QGraphicsLayoutItem* layout READ layout)
Q_PROPERTY(Reference reference READ reference WRITE setReference)
Q_PROPERTY(QGraphicsWidget* backWidget READ backWidget WRITE setBackWidget)
public:
RotationStackedAnimation(QObject *parent = 0);
~RotationStackedAnimation();
@ -44,9 +54,8 @@ class RotationStackedAnimation : public Animation
QGraphicsLayoutItem *layout();
void setWidgetsToAnimate(QGraphicsWidget *front, QGraphicsWidget *back);
QPair<QGraphicsWidget *, QGraphicsWidget *> widgetsToAnimate();
QGraphicsWidget *backWidget();
void setBackWidget(QGraphicsWidget *backWidget);
public Q_SLOTS:
void rotateBackWidget();

View File

@ -1,5 +1,5 @@
/***********************************************************************/
/* stackedlayout.h */
/* stackedlayout.c */
/* */
/* Copyright(C) 2009 Igor Trindade Oliveira <igor.oliveira@indt.org.br>*/
/* */

View File

@ -1,5 +1,5 @@
////////////////////////////////////////////////////////////////////////
// rotation.cpp //
// stackedlayout.h //
// //
// Copyright(C) 2009 Igor Trindade Oliveira <igor.oliveira@indt.org.br>//
// //