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/stickman.h | |
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/stickman.h')
-rw-r--r-- | examples/animation/stickman/stickman.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/examples/animation/stickman/stickman.h b/examples/animation/stickman/stickman.h index e8eedfa..d663c04 100644 --- a/examples/animation/stickman/stickman.h +++ b/examples/animation/stickman/stickman.h @@ -42,15 +42,15 @@ #ifndef STICKMAN_H #define STICKMAN_H -#include <QGraphicsItem> +#include <QGraphicsObject> -const int LimbCount = 16; +static const int NodeCount = 16; +static const int BoneCount = 24; class Node; QT_BEGIN_NAMESPACE -class QTimer; QT_END_NAMESPACE -class StickMan: public QObject, public QGraphicsItem +class StickMan: public QGraphicsObject { Q_OBJECT Q_PROPERTY(QColor penColor WRITE setPenColor READ penColor) @@ -77,7 +77,7 @@ public: bool isDead() const { return m_isDead; } void setIsDead(bool isDead) { m_isDead = isDead; } - + public slots: void stabilize(); void childPositionChanged(); @@ -86,10 +86,11 @@ protected: void timerEvent(QTimerEvent *e); private: + QPointF posFor(int idx) const; - Node **m_nodes; - qreal *m_perfectBoneLengths; + Node *m_nodes[NodeCount]; + qreal m_perfectBoneLengths[BoneCount]; uint m_sticks : 1; uint m_isDead : 1; |