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
qqstylekitanimation.cpp
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <QtCore/qglobal.h>
5
7
8/*!
9 \qmltype StyleAnimation
10 \inqmlmodule Qt.labs.StyleKit
11 \inherits ParallelAnimation
12 \brief A convenience type for animating style properties.
13
14 StyleAnimation is an \l [QtQuick]{Animation} that animates style properties
15 when a control changes \l {ControlStateStyle}{state}. For example, setting
16 \l animateBackgroundColors to \c true will animate all color properties of
17 the \l {ControlStyle::}{background}, such as \l {DelegateStyle::color}{background.color},
18 \l {BorderStyle::color}{background.border.color}, \l {ImageStyle::color}{background.image.color},
19 and \l {ShadowStyle::color}{background.shadow.color}. It is used inside a
20 \l {ControlStyle::}{transition}:
21
22 \snippet StyleAnimationSnippets.qml transition
23
24 StyleAnimation is just a convenience \l [QtQuick]{Animation} that handles listing the
25 affected style properties automatically. The snippet above could also be written as:
26
27 \snippet StyleAnimationSnippets.qml custom transition
28
29 A StyleAnimation can also be used together with other animations:
30
31 \snippet StyleAnimationSnippets.qml mixed transition
32
33 \labs
34
35 \sa {ControlStyleProperties::transition}{ControlStyle.transition}, ControlStyle
36*/
37
38/*!
39 \qmlproperty EasingCurve StyleAnimation::easing
40
41 The easing curve applied to the animation.
42
43 \sa duration, PropertyAnimation
44*/
45
46/*!
47 \qmlproperty int StyleAnimation::duration
48
49 The duration in milliseconds of the animation.
50
51 \sa easing, PropertyAnimation
52*/
53
54/*!
55 \qmlproperty bool StyleAnimation::animateColors
56
57 When \c true, animates all color properties across all delegates. This is a
58 shorthand for enabling \l animateBackgroundColors, \l animateHandleColors,
59 and \l animateIndicatorColors at once.
60
61 Note that \l ColorAnimation also animates all color properties that
62 change during a transition when \l {PropertyAnimation::}{property} and
63 \l {PropertyAnimation::}{properties} are both left unset. This makes it a
64 an alternative to StyleAnimation when only colors need to be animated.
65
66 \sa animateBackgroundColors, animateHandleColors, animateIndicatorColors
67*/
68
69/*!
70 \qmlproperty bool StyleAnimation::animateControlGeometry
71
72 When \c true, animates the control's geometry properties, such as
73 \l {ControlStyleProperties::spacing}{spacing} and
74 \l {ControlStyleProperties::padding}{padding}.
75*/
76
77/*!
78 \qmlproperty bool StyleAnimation::animateBackgroundColors
79
80 When \c true, animates the color properties of the
81 \l {ControlStyleProperties::}{background} delegate,
82 including \l {BorderStyle::color}{border} and \l {ShadowStyle::color}{shadow} colors.
83
84 \sa animateColors, animateBackgroundGeometry
85*/
86
87/*!
88 \qmlproperty bool StyleAnimation::animateBackgroundGeometry
89
90 When \c true, animates the geometry properties of the
91 \l {ControlStyleProperties::}{background} delegate,
92 such as \l {DelegateStyle::implicitWidth}{implicit size}
93 and \l {DelegateStyle::}{margins}.
94*/
95
96/*!
97 \qmlproperty bool StyleAnimation::animateBackgroundRadii
98
99 When \c true, animates the corner \l {DelegateStyle::radius}{radii} of the
100 \l {ControlStyleProperties::}{background} delegate.
101*/
102
103/*!
104 \qmlproperty bool StyleAnimation::animateBackgroundBorder
105
106 When \c true, animates the \l {BorderStyle::width}{border width} of the
107 \l {ControlStyleProperties::}{background} delegate.
108*/
109
110/*!
111 \qmlproperty bool StyleAnimation::animateBackgroundShadow
112
113 When \c true, animates the shadow properties of the
114 \l {ControlStyleProperties::}{background} delegate,
115 such as \l {ShadowStyle::verticalOffset}{vertical offset},
116 \l {ShadowStyle::horizontalOffset}{horizontal offset},
117 \l {ShadowStyle::scale}{scale}, and \l {ShadowStyle::blur}{blur}.
118 The shadow \l {ShadowStyle::color}{color} is animated by \l animateHandleColors.
119*/
120
121/*!
122 \qmlproperty bool StyleAnimation::animateBackgroundScaleAndRotation
123
124 When \c true, animates the and rotation of the
125 \l {ControlStyleProperties::}{background} delegate.
126*/
127
128/*!
129 \qmlproperty bool StyleAnimation::animateHandleColors
130
131 When \c true, animates the color properties of the
132 \l {ControlStyleProperties::}{handle} delegate and its \l {HandleStyle}{sub-handles},
133 including \l {BorderStyle::color}{border} and \l {ShadowStyle::color}{shadow} colors.
134
135 \sa animateColors, animateHandleGeometry
136*/
137
138/*!
139 \qmlproperty bool StyleAnimation::animateHandleGeometry
140
141 When \c true, animates the geometry properties of the
142 \l {ControlStyleProperties::}{handle} delegate and its \l {HandleStyle}{sub-handles},
143 such as \l {DelegateStyle::implicitWidth}{implicit size} and
144 \l {DelegateStyle::}{margins}.
145*/
146
147/*!
148 \qmlproperty bool StyleAnimation::animateHandleRadii
149
150 When \c true, animates the corner \l {DelegateStyle::radius}{radii} of the
151 \l {ControlStyleProperties::}{handle} delegate and its \l {HandleStyle}{sub-handles}.
152*/
153
154/*!
155 \qmlproperty bool StyleAnimation::animateHandleBorder
156
157 When \c true, animates the \l {BorderStyle::width}{border width} of the
158 \l {ControlStyleProperties::}{handle} delegate and its \l {HandleStyle}{sub-handles}.
159*/
160
161/*!
162 \qmlproperty bool StyleAnimation::animateHandleShadow
163
164 When \c true, animates the shadow properties of the
165 \l {ControlStyleProperties::}{handle} delegate and its \l {HandleStyle}{sub-handles},
166 such as \l {ShadowStyle::verticalOffset}{vertical offset},
167 \l {ShadowStyle::horizontalOffset}{horizontal offset},
168 \l {ShadowStyle::scale}{scale}, and \l {ShadowStyle::blur}{blur}.
169 The shadow \l {ShadowStyle::color}{color} is animated by \l animateHandleColors.
170*/
171
172/*!
173 \qmlproperty bool StyleAnimation::animateHandleScaleAndRotation
174
175 When \c true, animates the \l {DelegateStyle::}{scale} and \l {DelegateStyle::}{rotation} of the
176 \l {ControlStyleProperties::}{handle} delegate and its \l {HandleStyle}{sub-handles}.
177*/
178
179/*!
180 \qmlproperty bool StyleAnimation::animateIndicatorColors
181
182 When \c true, animates the color properties of the
183 \l {ControlStyleProperties::}{indicator} delegate and its \l {IndicatorStyle}{sub-indicators},
184 including \l {BorderStyle::color}{border} and \l {ShadowStyle::color}{shadow} colors.
185
186 \sa animateColors, animateIndicatorGeometry
187*/
188
189/*!
190 \qmlproperty bool StyleAnimation::animateIndicatorGeometry
191
192 When \c true, animates the geometry properties of the
193 \l {ControlStyleProperties::}{indicator} delegate and its \l {IndicatorStyle}{sub-indicators},
194 such as \l {DelegateStyle::implicitWidth}{implicit size} and \l {DelegateStyle::}{margins}.
195*/
196
197/*!
198 \qmlproperty bool StyleAnimation::animateIndicatorRadii
199
200 When \c true, animates the corner \l {DelegateStyle::radius}{radii} of the
201 \l {ControlStyleProperties::}{indicator} delegate and its \l {IndicatorStyle}{sub-indicators}.
202*/
203
204/*!
205 \qmlproperty bool StyleAnimation::animateIndicatorBorder
206
207 When \c true, animates the \l {BorderStyle::width}{border width} of the
208 \l {ControlStyleProperties::}{indicator} delegate and its \l {IndicatorStyle}{sub-indicators}.
209*/
210
211/*!
212 \qmlproperty bool StyleAnimation::animateIndicatorShadow
213
214 When \c true, animates the shadow properties of the
215 \l {ControlStyleProperties::}{indicator} delegate and its \l {IndicatorStyle}{sub-indicators},
216 such as \l {ShadowStyle::verticalOffset}{vertical offset},
217 \l {ShadowStyle::horizontalOffset}{horizontal offset},
218 \l {ShadowStyle::scale}{scale}, and \l {ShadowStyle::blur}{blur}.
219 The shadow \l {ShadowStyle::color}{color} is animated by \l animateHandleColors.
220*/
221
222/*!
223 \qmlproperty bool StyleAnimation::animateIndicatorScaleAndRotation
224
225 When \c true, animates the scale and rotation of the
226 \l {ControlStyleProperties::}{indicator} delegate and its \l {IndicatorStyle}{sub-indicators}.
227*/
228
\inmodule QtSql