diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-09-03 13:33:31 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-09-03 14:17:32 (GMT) |
commit | 99929a28df4812c86b4aabc4d02490d9fac87e85 (patch) | |
tree | 3af64ee824ae1ca2a2b53496d2ec3e99de73597a /examples/animation/stickman/main.cpp | |
parent | 245c63c306be18442ee9fd1178e30bfb4aad7717 (diff) | |
download | Qt-99929a28df4812c86b4aabc4d02490d9fac87e85.zip Qt-99929a28df4812c86b4aabc4d02490d9fac87e85.tar.gz Qt-99929a28df4812c86b4aabc4d02490d9fac87e85.tar.bz2 |
fix warnings in stickman demo on mingw
We now also use the brand-new QGraphicsObject class
We also make sure we have less memory leak or bad deallocation.
Diffstat (limited to 'examples/animation/stickman/main.cpp')
-rw-r--r-- | examples/animation/stickman/main.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/examples/animation/stickman/main.cpp b/examples/animation/stickman/main.cpp index 799f45c..f363d5d 100644 --- a/examples/animation/stickman/main.cpp +++ b/examples/animation/stickman/main.cpp @@ -73,30 +73,30 @@ int main(int argc, char **argv) QRectF stickManBoundingRect = stickMan->mapToScene(stickMan->boundingRect()).boundingRect(); textItem->setPos(-w / 2.0, stickManBoundingRect.bottom() + 25.0); - QGraphicsScene *scene = new QGraphicsScene(); - scene->addItem(stickMan); - scene->addItem(textItem); - scene->setBackgroundBrush(Qt::black); + QGraphicsScene scene; + scene.addItem(stickMan); + scene.addItem(textItem); + scene.setBackgroundBrush(Qt::black); - GraphicsView *view = new GraphicsView(); - view->setRenderHints(QPainter::Antialiasing); - view->setTransformationAnchor(QGraphicsView::NoAnchor); - view->setScene(scene); - view->show(); - view->setFocus(); + GraphicsView view; + view.setRenderHints(QPainter::Antialiasing); + view.setTransformationAnchor(QGraphicsView::NoAnchor); + view.setScene(&scene); + view.show(); + view.setFocus(); - QRectF sceneRect = scene->sceneRect(); + QRectF sceneRect = scene.sceneRect(); // making enough room in the scene for stickman to jump and die - view->resize(sceneRect.width() + 100, sceneRect.height() + 100); - view->setSceneRect(sceneRect); + view.resize(sceneRect.width() + 100, sceneRect.height() + 100); + view.setSceneRect(sceneRect); - LifeCycle *cycle = new LifeCycle(stickMan, view); - cycle->setDeathAnimation(":/animations/dead"); + LifeCycle cycle(stickMan, &view); + cycle.setDeathAnimation(":/animations/dead"); - cycle->addActivity(":/animations/jumping", Qt::Key_J); - cycle->addActivity(":/animations/dancing", Qt::Key_D); - cycle->addActivity(":/animations/chilling", Qt::Key_C); - cycle->start(); + cycle.addActivity(":/animations/jumping", Qt::Key_J); + cycle.addActivity(":/animations/dancing", Qt::Key_D); + cycle.addActivity(":/animations/chilling", Qt::Key_C); + cycle.start(); return app.exec(); } |