From ca07f45561aecf788dfbbbda9e36135f6fae69d2 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Tue, 14 Jan 2014 16:01:17 -0200 Subject: Added a new Namespace to deal with Animations and related functions. Since the animation methods are fairly the same for any QGraphicsItem, I created a new namespace named 'Animations' that should handle all of the specific Animation Functions there, and the programmer has to call those functions from the objects. Good thing is that this reduces boilerplate code. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/profile/animationfunctions.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 qt-ui/profile/animationfunctions.cpp (limited to 'qt-ui/profile/animationfunctions.cpp') diff --git a/qt-ui/profile/animationfunctions.cpp b/qt-ui/profile/animationfunctions.cpp new file mode 100644 index 000000000..1e307db87 --- /dev/null +++ b/qt-ui/profile/animationfunctions.cpp @@ -0,0 +1,24 @@ +#include "animationfunctions.h" +#include +#include + +namespace Animations{ + +void hide(QObject* obj) +{ + QPropertyAnimation *animation = new QPropertyAnimation(obj, "opacity"); + obj->connect(animation, SIGNAL(finished()), SLOT(deleteLater())); + animation->setStartValue(1); + animation->setEndValue(0); + animation->start(QAbstractAnimation::DeleteWhenStopped); +} + +void moveTo(QObject* obj, qreal x, qreal y) +{ + QPropertyAnimation *animation = new QPropertyAnimation(obj, "pos"); + animation->setStartValue(obj->property("pos").toPointF()); + animation->setEndValue(QPointF(x, y)); + animation->start(QAbstractAnimation::DeleteWhenStopped); +} + +} -- cgit v1.2.3-70-g09d2