Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
topic.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2017 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\page qtquick-statesanimations-topic.html
6
\title Important Concepts in Qt Quick - States, Transitions and Animations
7
\brief Description of the concepts of states, transitions and animations in Qt Quick
8
9
In any modern user-interface, transitioning between states and animating
10
the user-interface is highly beneficial. These are first-class concepts in
11
Qt Quick.
12
13
This page describes the concept of states, state transitions, and property
14
animations. It details which concepts are important and why, and how those
15
concepts interrelate. It also provides links to in-depth detail about the QML
16
types that Qt Quick provides to implement those concepts.
17
18
\section1 States
19
20
The state of a particular visual item is the set of information which describes
21
how and where the individual component parts of the visual item are displayed
22
within it, and all the data associated with that state. Most visual items in a
23
user-interface will have a limited number of states, each with well-defined
24
properties.
25
26
For example, an element in a list may be either selected or not, and if
27
selected, it may either be the currently active single selection or it may be
28
part of a selection group.
29
30
Each of those states may have certain associated visual appearance (neutral,
31
highlighted, expanded, and so forth).
32
33
Qt Quick provides a \c{State} type with properties which define its semantics
34
and can be used to trigger behavior or animations. See the documentation about
35
\l{qtquick-statesanimations-states.html}{Qt Quick States} for more
36
information.
37
38
\section1 Transitions
39
40
When a visual item transitions from one state to another, the appearance of
41
that item will change. A transition is an "edge" between two states. It may
42
trigger other events to occur, as other parts of the application may have
43
behavior which is triggered when a certain state is entered or left.
44
45
Qt Quick provides the \c{Transition} type which has properties which define
46
what will occur when the application changes from one state to another. See
47
the documentation on
48
\l{qtquick-statesanimations-animations.html#transitions-during-state-changes}
49
{Transitions during State Changes} for more information about transitions.
50
51
\section1 Animations
52
53
When transitioning between states, a fluid animation can be used to aid the
54
user during the transition. Abrupt and unexpected changes to the visual
55
canvas result in a suboptimal user-experience and should be avoided.
56
57
If an element in a list becomes selected, the color change (from neutral to
58
highlighted) can be animated. If the position of the element in the list is
59
changed, it can be moved in an fluidly animated fashion so that the eye of the
60
user can track the change.
61
62
These types of animations are supported in Qt Quick through various animation
63
and transition types. See the documentation on
64
\l{qtquick-statesanimations-animations.html}
65
{Animations and Transitions In Qt Quick} for information about these types
66
and how to use them.
67
68
69
\section1 Animating Property Assignments
70
71
Animations are not only related to states and transitions between states. For
72
example, an animation might be triggered by other events, which are not
73
associated with a distinct state.
74
75
It is often beneficial to always animate changes to certain properties of
76
visual items, regardless of the cause of the change (for example, opacity
77
effects). Qt Quick provides the \l Behavior type which allows the client to
78
specify animation behavior for changes to properties. The \l Behavior type
79
is an example of a QML object
80
\l{qtqml-cppintegration-definetypes.html#property-modifier-types}
81
{property modifier}.
82
83
Please see the documentation about
84
\l{qtquick-statesanimations-animations.html#default-animation-as-behaviors}
85
{default property animations} for more information about using the \l Behavior
86
type to provide default property change animations.
87
88
It is important to note, that using default property animations (via the
89
\l Behavior type) in combination with state-transition animations can sometimes
90
result in undefined behavior occurring. Please see the documentation about
91
\l{qtquick-statesanimations-behaviors.html}
92
{using Qt Quick Behaviors with States} for more information about this topic.
93
94
\section1 Animators
95
96
The \l Animator types are a special type of animation which bypass
97
the QML objects and operate directly on the primitives in the
98
\l {Qt Quick Scene Graph}{scene graph}. This has the benefit that
99
the Animator based animations can be run on the scene graph's rendering thread
100
(when applicable) and can continue to animate even when UI is otherwise
101
blocked.
102
103
Qt Quick provides the following Animator types:
104
\list
105
\li \l {XAnimator} - Animates the horizontal position of an \l {Item}.
106
\li \l {YAnimator} - Animates the vertical position of an \l {Item}.
107
\li \l {ScaleAnimator} - Animates the scale factor of an \l {Item}.
108
\li \l {RotationAnimator} - Animates the rotation of an \l {Item}.
109
\li \l {OpacityAnimator} - Animates the opacity of an \l {Item}.
110
\li \l {UniformAnimator} - Animates a uniform in a \l {ShaderEffect}.
111
\endlist
112
113
\section1 Animated Sprites
114
115
The concept of animated sprites is separate to the concept of animations as
116
used elsewhere on this page. If you want to create or use an animated image
117
or sprite, please see the documentation about
118
\l{qtquick-effects-sprites.html}{sprite animations}.
119
120
*/
qtdeclarative
src
quick
doc
src
concepts
statesanimations
topic.qdoc
Generated on
for Qt by
1.14.0