Revision control

Copy as Markdown

/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\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.
*/