summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-01-18 01:00:07 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-01-18 01:00:08 +0100
commit3e9f8b5249282324c615941af97f1ebf8a85991f (patch)
treef1a4b0a92abe0f0f238516f03b5d216e7912b643 /examples/widgets
parent800dda19a611339863aa5cfe6da13bc235d68e68 (diff)
parent9c172af7d5d8696a692fb2e040be11eae99a4b0c (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Diffstat (limited to 'examples/widgets')
-rw-r--r--examples/widgets/doc/src/padnavigator.qdoc21
-rw-r--r--examples/widgets/graphicsview/padnavigator/padnavigator.cpp8
2 files changed, 11 insertions, 18 deletions
diff --git a/examples/widgets/doc/src/padnavigator.qdoc b/examples/widgets/doc/src/padnavigator.qdoc
index e59fa3cdbe..d8e83978cf 100644
--- a/examples/widgets/doc/src/padnavigator.qdoc
+++ b/examples/widgets/doc/src/padnavigator.qdoc
@@ -387,17 +387,12 @@
\snippet graphicsview/padnavigator/padnavigator.cpp 7
We now create the animations that control the flip-effect when you press
- the enter key. The main goal is to rotate the pad by 180 degrees or back,
- but we also need to make sure the selection item's tilt rotations are reset
- back to 0 when the pad is flipped, and restored back to their original
- values when flipped back:
+ the enter key. The main goal is to rotate the pad by 180 degrees or back.
\list
\li \c smoothFlipRotation: Animates the main 180 degree rotation of the pad.
\li \c smoothFlipScale: Scales the pad out and then in again while the pad is rotating.
- \li \c smoothFlipXRotation: Animates the selection item's X-tilt to 0 and back.
- \li \c smoothFlipYRotation: Animates the selection item's Y-tilt to 0 and back.
- \li \c flipAnimation: A parallel animation group that ensures all the above animations are run in parallel.
+ \li \c flipAnimation: A parallel animation group that ensures the above animations are run in parallel.
\endlist
All animations are given a 500 millisecond duration and an
@@ -447,11 +442,17 @@
Each state assigns specific properties to objects on entry. Most
interesting perhaps is the assignment of the value 0.0 to the pad's \c
flipRotation angle property when in \c frontState, and 180.0 when in \c
- backState. At the end of this section we register default animations with
- the state engine; these animations will apply to their respective objects
- and properties for any state transition. Otherwise it's common to assign
+ backState.
+
+ At the end of this section we register default animations with the state
+ engine; these animations will apply to their respective objects and
+ properties for any state transition. Otherwise it's common to assign
animations to specific transitions.
+ Specifically, we use default animations to control the selection item's
+ movement and tilt rotations. The tilt rotations are set to 0 when the pad
+ is flipped, and restored back to their original values when flipped back.
+
The \c splashState state is set as the initial state. This is required
before we start the state engine. We proceed with creating some
transitions.
diff --git a/examples/widgets/graphicsview/padnavigator/padnavigator.cpp b/examples/widgets/graphicsview/padnavigator/padnavigator.cpp
index b9ce2a47ca..dbf89dd318 100644
--- a/examples/widgets/graphicsview/padnavigator/padnavigator.cpp
+++ b/examples/widgets/graphicsview/padnavigator/padnavigator.cpp
@@ -142,24 +142,16 @@ PadNavigator::PadNavigator(const QSize &size, QWidget *parent)
// Flip animation setup
QPropertyAnimation *smoothFlipRotation = new QPropertyAnimation(flipRotation, "angle");
QPropertyAnimation *smoothFlipScale = new QPropertyAnimation(pad, "scale");
- QPropertyAnimation *smoothFlipXRotation = new QPropertyAnimation(xRotation, "angle");
- QPropertyAnimation *smoothFlipYRotation = new QPropertyAnimation(yRotation, "angle");
QParallelAnimationGroup *flipAnimation = new QParallelAnimationGroup(this);
smoothFlipScale->setDuration(500);
smoothFlipRotation->setDuration(500);
- smoothFlipXRotation->setDuration(500);
- smoothFlipYRotation->setDuration(500);
smoothFlipScale->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipRotation->setEasingCurve(QEasingCurve::InOutQuad);
- smoothFlipXRotation->setEasingCurve(QEasingCurve::InOutQuad);
- smoothFlipYRotation->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipScale->setKeyValueAt(0, qvariant_cast<qreal>(1.0));
smoothFlipScale->setKeyValueAt(0.5, qvariant_cast<qreal>(0.7));
smoothFlipScale->setKeyValueAt(1, qvariant_cast<qreal>(1.0));
flipAnimation->addAnimation(smoothFlipRotation);
flipAnimation->addAnimation(smoothFlipScale);
- flipAnimation->addAnimation(smoothFlipXRotation);
- flipAnimation->addAnimation(smoothFlipYRotation);
//! [7]
//! [8]