Revision control
- // Copyright (C) 2016 The Qt Company Ltd.
- // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
- /*!
- \example animation/states
- \title States Example
- \ingroup examples-qtstatemachine
-
- \brief The States example shows how to use the Qt state machine to play
- animations.
-
- The example demonstrates how QStateMachine states can be used to animate
- properties of widgets. There are three states in the application that
- can be sequentially triggered by a button. The button initiates state transitions
- that animate the properties of the application widgets.
-
- \image states-example.png
-
- \section1 The \c main() Function
-
- \snippet animation/states/main.cpp 0
-
- The widgets are created and added to the QGraphicsScene. The Pixmap class is also
- defined in the example. It extends QGraphicsPixmapItem so that its position can be read
- and written as Qt properties.
-
- \snippet animation/states/main.cpp 1
-
- The state machine and the states are created.
-
- \image states-chart.png
-
- \snippet animation/states/main.cpp 2
-
- Each state is assigned the object properties that they will apply.
-
- \snippet animation/states/main.cpp 3
-
- The state transitions are created with the trigger of the button click.
- For each property, a QPropertyAnimation is created that interpolates between the
- property values.
-
- \snippet animation/states/main.cpp 4
-
- The state machine is started and the \c scene is assigned to a GraphicsView.
- */