diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-13 09:49:43 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-13 09:49:49 (GMT) |
commit | 6e209bb09f3feef210bc65f94cf8f58dd8e3b4a9 (patch) | |
tree | 94da799a697ebf32a98ccc13a53adfb2569f7c16 /demos | |
parent | b664d54867139b371e158f1c63076c4a970cbb2a (diff) | |
parent | 4f2dcef95299f2da628b30607021e8deb1d868b6 (diff) | |
download | Qt-6e209bb09f3feef210bc65f94cf8f58dd8e3b4a9.zip Qt-6e209bb09f3feef210bc65f94cf8f58dd8e3b4a9.tar.gz Qt-6e209bb09f3feef210bc65f94cf8f58dd8e3b4a9.tar.bz2 |
Merge oslo-staging-2/4.6 into upstream/4.6
Diffstat (limited to 'demos')
-rw-r--r-- | demos/sub-attaq/animationmanager.cpp | 7 | ||||
-rw-r--r-- | demos/sub-attaq/animationmanager.h | 3 | ||||
-rw-r--r-- | demos/sub-attaq/boat.cpp | 6 | ||||
-rw-r--r-- | demos/sub-attaq/graphicsscene.cpp | 1 |
4 files changed, 14 insertions, 3 deletions
diff --git a/demos/sub-attaq/animationmanager.cpp b/demos/sub-attaq/animationmanager.cpp index eb5a125..b3fc8e1 100644 --- a/demos/sub-attaq/animationmanager.cpp +++ b/demos/sub-attaq/animationmanager.cpp @@ -62,11 +62,18 @@ AnimationManager *AnimationManager::self() void AnimationManager::registerAnimation(QAbstractAnimation *anim) { + QObject::connect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*))); animations.append(anim); } +void AnimationManager::unregisterAnimation_helper(QObject *obj) +{ + unregisterAnimation(static_cast<QAbstractAnimation*>(obj)); +} + void AnimationManager::unregisterAnimation(QAbstractAnimation *anim) { + QObject::disconnect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*))); animations.removeAll(anim); } diff --git a/demos/sub-attaq/animationmanager.h b/demos/sub-attaq/animationmanager.h index 8db13eb..48d84d1 100644 --- a/demos/sub-attaq/animationmanager.h +++ b/demos/sub-attaq/animationmanager.h @@ -62,6 +62,9 @@ public slots: void pauseAll(); void resumeAll(); +private slots: + void unregisterAnimation_helper(QObject *obj); + private: static AnimationManager *instance; QList<QAbstractAnimation *> animations; diff --git a/demos/sub-attaq/boat.cpp b/demos/sub-attaq/boat.cpp index 0ad31b1..6fed9a9 100644 --- a/demos/sub-attaq/boat.cpp +++ b/demos/sub-attaq/boat.cpp @@ -62,7 +62,7 @@ static QAbstractAnimation *setupDestroyAnimation(Boat *boat) for (int i = 1; i <= 4; i++) { PixmapItem *step = new PixmapItem(QString("explosion/boat/step%1").arg(i),GraphicsScene::Big, boat); step->setZValue(6); - step->setOpacity(0); + step->setOpacity(0); //fade-in QPropertyAnimation *anim = new QPropertyAnimation(step, "opacity"); @@ -92,10 +92,10 @@ Boat::Boat() : PixmapItem(QString("boat"), GraphicsScene::Big), //The movement animation used to animate the boat movementAnimation = new QPropertyAnimation(this, "pos"); - //The movement animation used to animate the boat + //The destroy animation used to explode the boat destroyAnimation = setupDestroyAnimation(this); - //We setup the state machien of the boat + //We setup the state machine of the boat machine = new QStateMachine(this); QState *moving = new QState(machine); StopState *stopState = new StopState(this, moving); diff --git a/demos/sub-attaq/graphicsscene.cpp b/demos/sub-attaq/graphicsscene.cpp index e29095e..71d4fe7 100644 --- a/demos/sub-attaq/graphicsscene.cpp +++ b/demos/sub-attaq/graphicsscene.cpp @@ -278,4 +278,5 @@ void GraphicsScene::clearScene() boat->stop(); boat->hide(); + boat->setEnabled(true); } |