diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-08-12 10:40:30 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-08-12 10:42:20 (GMT) |
commit | e780030ca6990e73444646e6deae48145ca49972 (patch) | |
tree | 91ebea829ba4d71a7863be5401fab7fc9f46f894 /demos | |
parent | 031004dba57bff8eed8cdd0cd4c9ce44c9c36fd8 (diff) | |
download | Qt-e780030ca6990e73444646e6deae48145ca49972.zip Qt-e780030ca6990e73444646e6deae48145ca49972.tar.gz Qt-e780030ca6990e73444646e6deae48145ca49972.tar.bz2 |
QGraphicsRotation and QGraphicsRotation3D are now merged into 1 class
You can now also set the axis following hte Qt::Axis enum
Note: I'm not 100% sure about the maths in QGraphicsRotation::applyTo
Feel free to fix it.
Reviewed-by: ogoffart
Diffstat (limited to 'demos')
-rw-r--r-- | demos/sub-attaq/submarine.cpp | 2 | ||||
-rw-r--r-- | demos/sub-attaq/submarine.h | 4 | ||||
-rw-r--r-- | demos/sub-attaq/submarine_p.h | 5 |
3 files changed, 5 insertions, 6 deletions
diff --git a/demos/sub-attaq/submarine.cpp b/demos/sub-attaq/submarine.cpp index 857b009..383005d 100644 --- a/demos/sub-attaq/submarine.cpp +++ b/demos/sub-attaq/submarine.cpp @@ -111,7 +111,7 @@ SubMarine::SubMarine(int type, const QString &name, int points, QGraphicsItem * resize(pixmapItem->boundingRect().width(),pixmapItem->boundingRect().height()); setTransformOriginPoint(boundingRect().center()); - graphicsRotation = new QGraphicsRotation3D(this); + graphicsRotation = new QGraphicsRotation(this); graphicsRotation->setAxis(QVector3D(0, 1, 0)); graphicsRotation->setOrigin(QPointF(size().width()/2, size().height()/2)); QList<QGraphicsTransform *> r; diff --git a/demos/sub-attaq/submarine.h b/demos/sub-attaq/submarine.h index 0e4d074..1e33ba0 100644 --- a/demos/sub-attaq/submarine.h +++ b/demos/sub-attaq/submarine.h @@ -76,7 +76,7 @@ public: virtual int type() const; - QGraphicsRotation3D *rotation3d() const { return graphicsRotation; } + QGraphicsRotation *rotation() const { return graphicsRotation; } signals: void subMarineDestroyed(); @@ -90,7 +90,7 @@ private: int speed; Movement direction; PixmapItem *pixmapItem; - QGraphicsRotation3D *graphicsRotation; + QGraphicsRotation *graphicsRotation; }; #endif //__SUBMARINE__H__ diff --git a/demos/sub-attaq/submarine_p.h b/demos/sub-attaq/submarine_p.h index 1af820f..520fe2f 100644 --- a/demos/sub-attaq/submarine_p.h +++ b/demos/sub-attaq/submarine_p.h @@ -109,7 +109,8 @@ class ReturnState : public QAnimationState public: ReturnState(SubMarine *submarine, QState *parent = 0) : QAnimationState(parent) { - returnAnimation = new QPropertyAnimation(submarine->rotation3d(), "angle"); + returnAnimation = new QPropertyAnimation(submarine->rotation(), "angle"); + returnAnimation->setDuration(500); AnimationManager::self()->registerAnimation(returnAnimation); setAnimation(returnAnimation); this->submarine = submarine; @@ -119,9 +120,7 @@ protected: void onEntry(QEvent *e) { returnAnimation->stop(); - returnAnimation->setStartValue(submarine->rotation3d()->angle()); returnAnimation->setEndValue(submarine->currentDirection() == SubMarine::Right ? 360. : 180.); - returnAnimation->setDuration(500); QAnimationState::onEntry(e); } |