diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2014-01-15 13:01:29 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-01-16 10:12:30 +0700 |
commit | c301367259ba46c8603d391b1ec7e489e06aa7de (patch) | |
tree | b64562ed8c901dbded294461491efb8f94f4eadb /qt-ui | |
parent | 74cb7d6b2a666ccbaef5177ceeb40ac182a33a56 (diff) | |
download | subsurface-c301367259ba46c8603d391b1ec7e489e06aa7de.tar.gz |
Added the Animations for the transitions of the States.
This code creates the animations that will be triggered when an state
changes. Things like hiding items and such should be handled this way.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 9fbcb9a24..f052c88c8 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -8,6 +8,7 @@ #include <QStateMachine> #include <QSignalTransition> +#include <QPropertyAnimation> ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent), @@ -176,6 +177,30 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : planState->assignProperty(depthController, "y", depthControllerOnCanvas); planState->assignProperty(timeController, "y", timeControllerOnCanvas); + // All animations for the State Transitions. + QPropertyAnimation *backgroundYAnim = new QPropertyAnimation(background, "y"); + QPropertyAnimation *depthAxisAnim = new QPropertyAnimation(profileYAxis, "x"); + QPropertyAnimation *gasAxisanim = new QPropertyAnimation(gasYAxis, "x"); + QPropertyAnimation *timeAxisAnim = new QPropertyAnimation(timeAxis, "y"); + QPropertyAnimation *depthControlAnim = new QPropertyAnimation(depthController, "y"); + QPropertyAnimation *timeControlAnim = new QPropertyAnimation(timeController, "y"); + QPropertyAnimation *profileAxisAnim = new QPropertyAnimation(profileYAxis, "line"); + +// Animations + QList<QSignalTransition*> transitions; + transitions << tAddToEmpty << tAddToPlan << tAddToProfile << tEditToAdd << tEditToEmpty << tEditToPlan + << tEditToProfile << tEmptyToAdd << tEmptyToPlan << tEmptyToProfile << tProfileToAdd << tProfileToEdit + << tProfileToEmpty << tProfileToPlan << tPlanToAdd << tPlanToEmpty << tPlanToProfile; + Q_FOREACH(QSignalTransition *s, transitions){ + s->addAnimation(backgroundYAnim); + s->addAnimation(depthAxisAnim); + s->addAnimation(gasAxisanim); + s->addAnimation(timeAxisAnim); + s->addAnimation(depthControlAnim); + s->addAnimation(timeControlAnim); + s->addAnimation(profileAxisAnim); + } + } // Currently just one dive, but the plan is to enable All of the selected dives. |