From 889316a3f57b57160e2a08fc41def774d56e288c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 14 May 2009 15:53:44 +0200 Subject: Start work on docs for Stickman example --- examples/animation/stickman/lifecycle.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp index 423d7ad..6b69a26 100644 --- a/examples/animation/stickman/lifecycle.cpp +++ b/examples/animation/stickman/lifecycle.cpp @@ -141,9 +141,10 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver) m_alive->setInitialState(m_idle); // Lightning strikes at random +//! [0] m_alive->addTransition(new LightningStrikesTransition(lightningBlink)); - //m_alive->addTransition(new KeyPressTransition(m_keyReceiver, Qt::Key_L, lightningBlink)); connectByAnimation(lightningBlink, m_dead, new QSignalTransition(timer, SIGNAL(timeout()))); +//! [0] m_machine->setInitialState(m_alive); } @@ -159,8 +160,8 @@ void LifeCycle::start() m_machine->start(); } -void LifeCycle::connectByAnimation(QState *s1, QAbstractState *s2, - QAbstractTransition *transition) +//! [1] +void LifeCycle::connectByAnimation(QState *s1, QAbstractState *s2, QAbstractTransition *transition) { if (transition == 0) { transition = s1->addTransition(s2); @@ -170,6 +171,7 @@ void LifeCycle::connectByAnimation(QState *s1, QAbstractState *s2, } transition->addAnimation(m_animationGroup); } +//! [1] void LifeCycle::addActivity(const QString &fileName, Qt::Key key) { -- cgit v0.12 From 9400e522d7b89025157657ec87fb1631fc6bf4de Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 14 May 2009 16:50:23 +0200 Subject: Remove the connectByAnimation() function and add some documentation for the Stickman example The connectByAnimation() function is no longer needed since we have default animations. The docs are unfinished. --- doc/src/examples/stickman.qdoc | 115 ++++++++++++++++++++++++++++++ doc/src/images/stickman-example.png | Bin 0 -> 18867 bytes doc/src/images/stickman-example1.png | Bin 0 -> 8311 bytes examples/animation/stickman/lifecycle.cpp | 48 ++++++------- examples/animation/stickman/lifecycle.h | 2 - 5 files changed, 137 insertions(+), 28 deletions(-) create mode 100644 doc/src/examples/stickman.qdoc create mode 100644 doc/src/images/stickman-example.png create mode 100644 doc/src/images/stickman-example1.png diff --git a/doc/src/examples/stickman.qdoc b/doc/src/examples/stickman.qdoc new file mode 100644 index 0000000..0313c81 --- /dev/null +++ b/doc/src/examples/stickman.qdoc @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example animation/stickman + \title Stickman Example + + The Stickman example shows how to animate transitions in a state machine to implement key frame + animations. + + \image stickman-example.png + + In this example, we will write a small application which animates the joints in a skeleton and + projects a stickman figure on top. The stickman can be either "alive" or "dead", and when in the + "alive" state, he can be performing different actions defined by key frame animations. + + Animations are implemented as composite states. Each child state of the animation state + represents a frame in the animation by setting the position of each joint in the stickman's + skeleton to the positions defined for the particular frame. The frames are then bound together + with animated transitions that trigger on the source state's polished() signal. Thus, the + machine will enter the state representing the next state in the animation immediately after it + has finished animating into the previous frame. + + \image stickman-example1.png + + The states for an animation is constructed by reading a custom animation file format and + creating states that assign values to the the "position" properties of each of the nodes in the + skeleton graph. + + \snippet examples/animation/stickman/lifecycle.cpp 1 + + The states are then bound together with signal transitions that listen to the polished() signal. + + \snippet examples/animation/stickman/lifecycle.cpp 2 + + The last frame state is given a transition to the first one, so that the animation will loop + until it is interrupted when a transition out from the animation state is taken. To get smooth + animations between the different key frames, we set a default animation on the state machine. + This is a parallel animation group which contain animations for all the "position" properties + and will be selected by default when taking any transition that leads into a state that assigns + values to these properties. + + \snippet examples/animation/stickman/lifecycle.cpp 3 + + Several such animation states are constructed, and are placed together as children of a top + level "alive" state which represents the stickman life cycle. Transitions go from the parent + state to the child state to ensure that each of the child states inherit them. + + \image stickman-example2.png + + This saves us the effort of connect every state to every state with identical transitions. The + state machine makes sure that transitions between the key frame animations are also smooth by + applying the default animation when interrupting one and starting another. + + Finally, there is a transition out from the "alive" state and into the "dead" state. This is + a custom transition type called LightningStrikesTransition which samples every second and + triggers at random (one out of fifty times on average.) + + \snippet examples/animation/stickman/lifecycle.cpp 4 + + When it triggers, the machine will first enter a "lightningStrike" state which uses a timer to + pause for a brief period of time while the background color of the scene is white. This gives us + a flash effect when the lightning strikes. + + \snippet examples/animation/stickman/lifecycle.cpp 5 + + We start and stop a QTimer object when entering and exiting the state. Then we transition into + the "dead" state when the timer times out. + + \snippet examples/animation/stickman/lifecycle.cpp 0 + + When the machine is in the "dead" state, it will be unresponsive. This is because the "dead" + state has no transitions leading out. + + \image stickman-example3.png + +*/ diff --git a/doc/src/images/stickman-example.png b/doc/src/images/stickman-example.png new file mode 100644 index 0000000..a40f37b Binary files /dev/null and b/doc/src/images/stickman-example.png differ diff --git a/doc/src/images/stickman-example1.png b/doc/src/images/stickman-example1.png new file mode 100644 index 0000000..7b9a5b8 Binary files /dev/null and b/doc/src/images/stickman-example1.png differ diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp index 6b69a26..1feb31d 100644 --- a/examples/animation/stickman/lifecycle.cpp +++ b/examples/animation/stickman/lifecycle.cpp @@ -82,6 +82,7 @@ private: Qt::Key m_key; }; +//! [4] class LightningStrikesTransition: public QEventTransition { public: @@ -97,6 +98,7 @@ public: return QEventTransition::eventTest(e) && ((qrand() % 50) == 0); } }; +//! [4] LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver) : m_stickMan(stickMan), m_keyReceiver(keyReceiver) @@ -110,7 +112,10 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver) } // Set up intial state graph +//! [3] m_machine = new QStateMachine(); + m_machine->addDefaultAnimation(m_animationGroup); +//! [3] m_alive = new QState(m_machine->rootState()); m_alive->setObjectName("alive"); @@ -122,11 +127,13 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver) lightningBlink->assignProperty(m_stickMan, "fillColor", Qt::white); lightningBlink->assignProperty(m_stickMan, "isDead", true); +//! [5] QTimer *timer = new QTimer(lightningBlink); timer->setSingleShot(true); timer->setInterval(100); QObject::connect(lightningBlink, SIGNAL(entered()), timer, SLOT(start())); QObject::connect(lightningBlink, SIGNAL(exited()), timer, SLOT(stop())); +//! [5] m_dead = new QState(m_machine->rootState()); m_dead->assignProperty(m_stickMan->scene(), "backgroundBrush", Qt::black); @@ -141,9 +148,9 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver) m_alive->setInitialState(m_idle); // Lightning strikes at random -//! [0] m_alive->addTransition(new LightningStrikesTransition(lightningBlink)); - connectByAnimation(lightningBlink, m_dead, new QSignalTransition(timer, SIGNAL(timeout()))); +//! [0] + lightningBlink->addTransition(timer, SIGNAL(timeout()), m_dead); //! [0] m_machine->setInitialState(m_alive); @@ -160,23 +167,10 @@ void LifeCycle::start() m_machine->start(); } -//! [1] -void LifeCycle::connectByAnimation(QState *s1, QAbstractState *s2, QAbstractTransition *transition) -{ - if (transition == 0) { - transition = s1->addTransition(s2); - } else { - transition->setTargetState(s2); - s1->addTransition(transition); - } - transition->addAnimation(m_animationGroup); -} -//! [1] - void LifeCycle::addActivity(const QString &fileName, Qt::Key key) { QState *state = makeState(m_alive, fileName); - connectByAnimation(m_alive, state, new KeyPressTransition(m_keyReceiver, key)); + m_alive->addTransition(new KeyPressTransition(m_keyReceiver, key, state)); } QState *LifeCycle::makeState(QState *parentState, const QString &animationFileName) @@ -193,26 +187,28 @@ QState *LifeCycle::makeState(QState *parentState, const QString &animationFileNa const int frameCount = animation.totalFrames(); QState *previousState = 0; for (int i=0; isetObjectName(QString::fromLatin1("frame %0").arg(i)); - animation.setCurrentFrame(i); + +//! [1] + QState *frameState = new QState(topLevel); const int nodeCount = animation.nodeCount(); for (int j=0; jassignProperty(m_stickMan->node(j), "position", animation.nodePos(j)); +//! [1] - if (previousState == 0) { + frameState->setObjectName(QString::fromLatin1("frame %0").arg(i)); + if (previousState == 0) topLevel->setInitialState(frameState); - } else { - connectByAnimation(previousState, frameState, - new QSignalTransition(previousState, SIGNAL(polished()))); - } + else +//! [2] + previousState->addTransition(previousState, SIGNAL(polished()), frameState); +//! [2] + previousState = frameState; } // Loop - connectByAnimation(previousState, topLevel->initialState(), - new QSignalTransition(previousState, SIGNAL(polished()))); + previousState->addTransition(previousState, SIGNAL(polished()), topLevel->initialState()); return topLevel; diff --git a/examples/animation/stickman/lifecycle.h b/examples/animation/stickman/lifecycle.h index e520402..8fd0fb2 100644 --- a/examples/animation/stickman/lifecycle.h +++ b/examples/animation/stickman/lifecycle.h @@ -63,8 +63,6 @@ public: void start(); private: - void connectByAnimation(QState *s1, QAbstractState *s2, - QAbstractTransition *transition = 0); QState *makeState(QState *parentState, const QString &animationFileName); StickMan *m_stickMan; -- cgit v0.12 From a5a842b3aa3e4033a116275c04b17d37d5595cc5 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 15 May 2009 16:45:47 +0200 Subject: doc: Update signature of eventTest() in documentation eventTest() is now non-const. --- src/corelib/statemachine/qabstracttransition.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp index a930581..68423cb 100644 --- a/src/corelib/statemachine/qabstracttransition.cpp +++ b/src/corelib/statemachine/qabstracttransition.cpp @@ -321,7 +321,7 @@ QList QAbstractTransition::animations() const #endif /*! - \fn QAbstractTransition::eventTest(QEvent *event) const + \fn QAbstractTransition::eventTest(QEvent *event) This function is called to determine whether the given \a event should cause this transition to trigger. Reimplement this function and return true if the -- cgit v0.12 From c11b50366069b9c5a0daa74dc3511d91ceafe564 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 15 May 2009 17:01:37 +0200 Subject: doc: New state chart diagrams for Stickman example These obviously cannot be used, since they have the "unregistered version" watermark on them. Didn't notice before now, so I might as well commit them for the time being. --- doc/src/images/stickman-example1.png | Bin 8311 -> 33216 bytes doc/src/images/stickman-example2.png | Bin 0 -> 23521 bytes doc/src/images/stickman-example3.png | Bin 0 -> 12265 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 doc/src/images/stickman-example2.png create mode 100644 doc/src/images/stickman-example3.png diff --git a/doc/src/images/stickman-example1.png b/doc/src/images/stickman-example1.png index 7b9a5b8..8ee364b 100644 Binary files a/doc/src/images/stickman-example1.png and b/doc/src/images/stickman-example1.png differ diff --git a/doc/src/images/stickman-example2.png b/doc/src/images/stickman-example2.png new file mode 100644 index 0000000..0e4c57d Binary files /dev/null and b/doc/src/images/stickman-example2.png differ diff --git a/doc/src/images/stickman-example3.png b/doc/src/images/stickman-example3.png new file mode 100644 index 0000000..62f41eb Binary files /dev/null and b/doc/src/images/stickman-example3.png differ -- cgit v0.12 From 3d99537a86144b8f22ef10891ba6cc55820b987a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 18 May 2009 14:24:58 +0200 Subject: doc: Minor fixes + update UML diagrams for stick man example Using StarUML this time, since there were "unregistered version" watermarks on the Enterprise Architect ones. Not as nice, but it's impossible to find a free UML tool which produces nice diagrams. --- doc/src/examples.qdoc | 6 ++++++ doc/src/examples/stickman.qdoc | 8 ++++---- doc/src/images/stickman-example1.png | Bin 33216 -> 64543 bytes doc/src/images/stickman-example2.png | Bin 23521 -> 37412 bytes doc/src/images/stickman-example3.png | Bin 12265 -> 23591 bytes 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/src/examples.qdoc b/doc/src/examples.qdoc index 6603390..c55d29f 100644 --- a/doc/src/examples.qdoc +++ b/doc/src/examples.qdoc @@ -86,6 +86,12 @@ \o \l{activeqt/webbrowser}{Web Browser}\raisedaster \o \l{activeqt/wrapper}{Wrapper}\raisedaster \endlist + + \section1 Animation + + \list + \o \l{animation/stickman}{Stick man}\raisedaster + \endlist \section1 Concurrent Programming diff --git a/doc/src/examples/stickman.qdoc b/doc/src/examples/stickman.qdoc index 0313c81..49f4953 100644 --- a/doc/src/examples/stickman.qdoc +++ b/doc/src/examples/stickman.qdoc @@ -56,7 +56,7 @@ represents a frame in the animation by setting the position of each joint in the stickman's skeleton to the positions defined for the particular frame. The frames are then bound together with animated transitions that trigger on the source state's polished() signal. Thus, the - machine will enter the state representing the next state in the animation immediately after it + machine will enter the state representing the next frame in the animation immediately after it has finished animating into the previous frame. \image stickman-example1.png @@ -74,7 +74,7 @@ The last frame state is given a transition to the first one, so that the animation will loop until it is interrupted when a transition out from the animation state is taken. To get smooth animations between the different key frames, we set a default animation on the state machine. - This is a parallel animation group which contain animations for all the "position" properties + This is a parallel animation group which contains animations for all the "position" properties and will be selected by default when taking any transition that leads into a state that assigns values to these properties. @@ -91,12 +91,12 @@ applying the default animation when interrupting one and starting another. Finally, there is a transition out from the "alive" state and into the "dead" state. This is - a custom transition type called LightningStrikesTransition which samples every second and + a custom transition type called LightningSrikesTransition which samples every second and triggers at random (one out of fifty times on average.) \snippet examples/animation/stickman/lifecycle.cpp 4 - When it triggers, the machine will first enter a "lightningStrike" state which uses a timer to + When it triggers, the machine will first enter a "lightningBlink" state which uses a timer to pause for a brief period of time while the background color of the scene is white. This gives us a flash effect when the lightning strikes. diff --git a/doc/src/images/stickman-example1.png b/doc/src/images/stickman-example1.png index 8ee364b..1596a68 100644 Binary files a/doc/src/images/stickman-example1.png and b/doc/src/images/stickman-example1.png differ diff --git a/doc/src/images/stickman-example2.png b/doc/src/images/stickman-example2.png index 0e4c57d..980276a 100644 Binary files a/doc/src/images/stickman-example2.png and b/doc/src/images/stickman-example2.png differ diff --git a/doc/src/images/stickman-example3.png b/doc/src/images/stickman-example3.png index 62f41eb..3635ff7 100644 Binary files a/doc/src/images/stickman-example3.png and b/doc/src/images/stickman-example3.png differ -- cgit v0.12 From 8ef2feacb26eabdc6e82c4a85b6f3e30665477ba Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Tue, 19 May 2009 13:35:24 +0200 Subject: Whitespace cleanup in QEasingCurve --- src/corelib/tools/qeasingcurve.cpp | 89 +++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 45 deletions(-) diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index a1a0d1f..72965de5 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -99,7 +99,7 @@ \br Easing equation function for a simple linear tweening, with no easing. - \value InQuad \inlineimage qeasingcurve-inquad.png + \value InQuad \inlineimage qeasingcurve-inquad.png \br Easing equation function for a quadratic (t^2) easing in: accelerating from zero velocity. @@ -107,7 +107,7 @@ \br Easing equation function for a quadratic (t^2) easing out: decelerating to zero velocity. - \value InOutQuad \inlineimage qeasingcurve-inoutquad.png + \value InOutQuad \inlineimage qeasingcurve-inoutquad.png \br Easing equation function for a quadratic (t^2) easing in/out: acceleration until halfway, then deceleration. @@ -121,11 +121,11 @@ in: accelerating from zero velocity. \value OutCubic \inlineimage qeasingcurve-outcubic.png \br - Easing equation function for a cubic (t^3) easing + Easing equation function for a cubic (t^3) easing out: decelerating from zero velocity. \value InOutCubic \inlineimage qeasingcurve-inoutcubic.png \br - Easing equation function for a cubic (t^3) easing + Easing equation function for a cubic (t^3) easing in/out: acceleration until halfway, then deceleration. \value OutInCubic \inlineimage qeasingcurve-outincubic.png \br @@ -133,55 +133,55 @@ out/in: deceleration until halfway, then acceleration. \value InQuart \inlineimage qeasingcurve-inquart.png \br - Easing equation function for a quartic (t^4) easing + Easing equation function for a quartic (t^4) easing in: accelerating from zero velocity. \value OutQuart \inlineimage qeasingcurve-outquart.png \br - Easing equation function for a quartic (t^4) easing + Easing equation function for a quartic (t^4) easing out: decelerating from zero velocity. \value InOutQuart \inlineimage qeasingcurve-inoutquart.png \br - Easing equation function for a quartic (t^4) easing + Easing equation function for a quartic (t^4) easing in/out: acceleration until halfway, then deceleration. \value OutInQuart \inlineimage qeasingcurve-outinquart.png \br - Easing equation function for a quartic (t^4) easing + Easing equation function for a quartic (t^4) easing out/in: deceleration until halfway, then acceleration. \value InQuint \inlineimage qeasingcurve-inquint.png \br - Easing equation function for a quintic (t^5) easing + Easing equation function for a quintic (t^5) easing in: accelerating from zero velocity. \value OutQuint \inlineimage qeasingcurve-outquint.png \br - Easing equation function for a quintic (t^5) easing + Easing equation function for a quintic (t^5) easing out: decelerating from zero velocity. \value InOutQuint \inlineimage qeasingcurve-inoutquint.png \br - Easing equation function for a quintic (t^5) easing + Easing equation function for a quintic (t^5) easing in/out: acceleration until halfway, then deceleration. \value OutInQuint \inlineimage qeasingcurve-outinquint.png \br - Easing equation function for a quintic (t^5) easing + Easing equation function for a quintic (t^5) easing out/in: deceleration until halfway, then acceleration. \value InSine \inlineimage qeasingcurve-insine.png \br - Easing equation function for a sinusoidal (sin(t)) easing + Easing equation function for a sinusoidal (sin(t)) easing in: accelerating from zero velocity. \value OutSine \inlineimage qeasingcurve-outsine.png \br - Easing equation function for a sinusoidal (sin(t)) easing + Easing equation function for a sinusoidal (sin(t)) easing out: decelerating from zero velocity. \value InOutSine \inlineimage qeasingcurve-inoutsine.png \br - Easing equation function for a sinusoidal (sin(t)) easing + Easing equation function for a sinusoidal (sin(t)) easing in/out: acceleration until halfway, then deceleration. \value OutInSine \inlineimage qeasingcurve-outinsine.png \br - Easing equation function for a sinusoidal (sin(t)) easing + Easing equation function for a sinusoidal (sin(t)) easing out/in: deceleration until halfway, then acceleration. \value InExpo \inlineimage qeasingcurve-inexpo.png \br - Easing equation function for an exponential (2^t) easing + Easing equation function for an exponential (2^t) easing in: accelerating from zero velocity. \value OutExpo \inlineimage qeasingcurve-outexpo.png \br @@ -213,47 +213,47 @@ out/in: deceleration until halfway, then acceleration. \value InElastic \inlineimage qeasingcurve-inelastic.png \br - Easing equation function for an elastic - (exponentially decaying sine wave) easing in: + Easing equation function for an elastic + (exponentially decaying sine wave) easing in: accelerating from zero velocity. The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter. \value OutElastic \inlineimage qeasingcurve-outelastic.png \br - Easing equation function for an elastic - (exponentially decaying sine wave) easing out: - decelerating from zero velocity. The peak amplitude - can be set with the \e amplitude parameter, and the + Easing equation function for an elastic + (exponentially decaying sine wave) easing out: + decelerating from zero velocity. The peak amplitude + can be set with the \e amplitude parameter, and the period of decay by the \e period parameter. \value InOutElastic \inlineimage qeasingcurve-inoutelastic.png \br - Easing equation function for an elastic - (exponentially decaying sine wave) easing in/out: + Easing equation function for an elastic + (exponentially decaying sine wave) easing in/out: acceleration until halfway, then deceleration. \value OutInElastic \inlineimage qeasingcurve-outinelastic.png \br - Easing equation function for an elastic - (exponentially decaying sine wave) easing out/in: + Easing equation function for an elastic + (exponentially decaying sine wave) easing out/in: deceleration until halfway, then acceleration. \value InBack \inlineimage qeasingcurve-inback.png \br - Easing equation function for a back (overshooting - cubic easing: (s+1)*t^3 - s*t^2) easing in: + Easing equation function for a back (overshooting + cubic easing: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity. \value OutBack \inlineimage qeasingcurve-outback.png \br - Easing equation function for a back (overshooting - cubic easing: (s+1)*t^3 - s*t^2) easing out: + Easing equation function for a back (overshooting + cubic easing: (s+1)*t^3 - s*t^2) easing out: decelerating from zero velocity. \value InOutBack \inlineimage qeasingcurve-inoutback.png \br - Easing equation function for a back (overshooting - cubic easing: (s+1)*t^3 - s*t^2) easing in/out: + Easing equation function for a back (overshooting + cubic easing: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration. \value OutInBack \inlineimage qeasingcurve-outinback.png \br - Easing equation function for a back (overshooting - cubic easing: (s+1)*t^3 - s*t^2) easing out/in: + Easing equation function for a back (overshooting + cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration. \value InBounce \inlineimage qeasingcurve-inbounce.png \br @@ -283,14 +283,13 @@ \omitvalue NCurveTypes */ -/*! +/*! \typedef QEasingCurve::EasingFunction This is a typedef for a pointer to a function with the following signature: \snippet doc/src/snippets/code/src_corelib_tools_qeasingcurve.cpp 0 - */ #include "qeasingcurve.h" @@ -646,10 +645,10 @@ bool QEasingCurve::operator==(const QEasingCurve &other) const \fn bool QEasingCurve::operator!=(const QEasingCurve &other) const Compare this easing curve with \a other and returns true if they are not equal. It will also compare the properties of a curve. - + \sa operator==() */ - + /*! Returns the amplitude. This is not applicable for all curve types. It is only applicable for bounce and elastic curves (curves of type() @@ -664,8 +663,8 @@ qreal QEasingCurve::amplitude() const /*! Sets the amplitude to \a amplitude. - - This will set the amplitude of the bounce or the amplitude of the + + This will set the amplitude of the bounce or the amplitude of the elastic "spring" effect. The higher the number, the higher the amplitude. \sa amplitude() */ @@ -688,7 +687,7 @@ qreal QEasingCurve::period() const /*! Sets the period to \a period. - Setting a small period value will give a high frequency of the curve. A + Setting a small period value will give a high frequency of the curve. A large period will give it a small frequency. \sa period() @@ -745,7 +744,7 @@ void QEasingCurvePrivate::setType_helper(QEasingCurve::Type newType) delete config; config = 0; } - + if (isConfigFunction(newType) || (amp != -1.0) || (period != -1.0) || (overshoot != -1.0)) { config = curveToFunctionObject(newType); if (amp != -1.0) @@ -800,7 +799,7 @@ void QEasingCurve::setCustomType(EasingFunction func) /*! Returns the function pointer to the custom easing curve. - If type() does not return QEasingCurve::Custom, this function + If type() does not return QEasingCurve::Custom, this function will return 0. */ QEasingCurve::EasingFunction QEasingCurve::customType() const @@ -830,7 +829,7 @@ qreal QEasingCurve::valueForProgress(qreal progress) const #include QDebug operator<<(QDebug debug, const QEasingCurve &item) { - debug << "type:" << item.d_ptr->type + debug << "type:" << item.d_ptr->type << "func:" << item.d_ptr->func; if (item.d_ptr->config) { debug << QString::fromAscii("period:%1").arg(item.d_ptr->config->_p, 0, 'f', 20) -- cgit v0.12 From a903f9fb54f7192795abffca0a99b54d419bdb7a Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Tue, 19 May 2009 13:35:58 +0200 Subject: Removed memory leak in QEasingCurvePrivate Task-number: 253898 --- src/corelib/tools/qeasingcurve.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 72965de5..9ef9149 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -354,6 +354,7 @@ public: config(0), func(&easeNone) { } + ~QEasingCurvePrivate() { delete config; } void setType_helper(QEasingCurve::Type); QEasingCurve::Type type; -- cgit v0.12