Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickanimation.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 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 "qquickanimation_p.h"
6
8
9#include <private/qquickstatechangescript_p.h>
10#include <private/qqmlcontext_p.h>
11
13#include <qqml.h>
14#include <qqmlinfo.h>
15#include <qqmlexpression.h>
16#include <private/qqmlstringconverters_p.h>
17#include <private/qqmlglobal_p.h>
18#include <private/qqmlmetatype_p.h>
19#include <private/qqmlvaluetype_p.h>
20#include <private/qqmlproperty_p.h>
21#include <private/qqmlengine_p.h>
22
23#include <qvariant.h>
24#include <qcolor.h>
25#include <qfile.h>
26#include "private/qparallelanimationgroupjob_p.h"
27#include "private/qsequentialanimationgroupjob_p.h"
28#include <QtCore/qset.h>
29#include <QtCore/qrect.h>
30#include <QtCore/qpoint.h>
31#include <QtCore/qsize.h>
32#include <QtCore/qmath.h>
33
35
53
55{
57 if (d->group)
58 setGroup(nullptr); //remove from group
59 delete d->animationInstance;
60}
61
66
72
108{
109 Q_D(const QQuickAbstractAnimation);
110 return d->running;
111}
112
113// the behavior calls this function
114void QQuickAbstractAnimation::notifyRunningChanged(bool running)
115{
117 if (d->disableUserControl && d->running != running) {
118 d->running = running;
120 }
121}
122
123//commence is called to start an animation when it is used as a
124//simple animation, and not as part of a transition
146
148{
149 QQmlProperty prop(obj, str, qmlContext(infoObj));
150 if (!prop.isValid()) {
151 const QString message = QQuickAbstractAnimation::tr("Cannot animate non-existent property \"%1\"").arg(str);
152 if (errorMessage)
154 else
155 qmlWarning(infoObj) << message;
156 return QQmlProperty();
157 } else if (!prop.isWritable()) {
158 const QString message = QQuickAbstractAnimation::tr("Cannot animate read-only property \"%1\"").arg(str);
159 if (errorMessage)
161 else
162 qmlWarning(infoObj) << message;
163 return QQmlProperty();
164 }
165 return prop;
166}
167
169{
170 Q_ASSERT(group != nullptr);
172 return;
173
174 auto *animGroupPriv = static_cast<QQuickAnimationGroupPrivate *>(QQuickAnimationGroupPrivate::get(group));
175 if (animGroupPriv->running && !animGroupPriv->animationDirty) {
176 animGroupPriv->animationDirty = true;
177
178 if (animGroupPriv->animationInstance && group->currentTime() == 0) {
179 // restart if the animation didn't proceed yet.
180 animGroupPriv->restartFromCurrentLoop();
181 }
182 }
183
184 // check the animationGroup is one of another animationGroup members
185 if (animGroupPriv->group)
186 animGroupPriv->animationGroupDirty();
187}
188
234{
236 if (!d->componentComplete) {
237 d->running = r;
238 if (r == false)
239 d->avoidPropertyValueSourceStart = true;
240 else if (!d->needsDeferredSetRunning)
241 d->needsDeferredSetRunning = true;
242 return;
243 }
244
245 if (d->running == r)
246 return;
247
248 if (d->group || d->disableUserControl) {
249 qmlWarning(this) << "setRunning() cannot be used on non-root animation nodes.";
250 return;
251 }
252
253 d->running = r;
254 if (d->running) {
255 bool supressStart = false;
256 if (d->alwaysRunToEnd && d->loopCount != 1
257 && d->animationInstance && d->animationInstance->isRunning()) {
258 //we've restarted before the final loop finished; restore proper loop count
259 if (d->loopCount == -1)
260 d->animationInstance->setLoopCount(d->loopCount);
261 else
262 d->animationInstance->setLoopCount(d->animationInstance->currentLoop() + d->loopCount);
263 supressStart = true; //we want the animation to continue, rather than restart
264 }
265 if (!supressStart)
266 d->commence();
267 } else {
268 if (d->paused) {
269 d->paused = false; //reset paused state to false when stopped
270 emit pausedChanged(d->paused);
271 }
272
273 if (d->animationInstance) {
274 if (d->alwaysRunToEnd) {
275 if (d->loopCount != 1)
276 d->animationInstance->setLoopCount(d->animationInstance->currentLoop()+1); //finish the current loop
277 } else {
278 d->animationInstance->stop();
279 emit stopped();
280 }
281 }
282 }
283
284
285 if (r == d->running) {
286 // This might happen if we start an animation with 0 duration: This will result in that
287 // commence() will emit started(), and then when it starts it will call setCurrentTime(0),
288 // (which is both start and end time of the animation), so it will also end up calling
289 // setRunning(false) (recursively) and stop the animation.
290 // Therefore, the state of d->running will in that case be different than r if we are back in
291 // the root stack frame of the recursive calls to setRunning()
292 emit runningChanged(d->running);
293 }
294}
295
309{
310 Q_D(const QQuickAbstractAnimation);
311 Q_ASSERT((d->paused && d->running) || !d->paused);
312 return d->paused;
313}
314
316{
318 if (d->paused == p)
319 return;
320
321 if (!d->running) {
322 qmlWarning(this) << "setPaused() cannot be used when animation isn't running.";
323 return;
324 }
325
326 if (d->group || d->disableUserControl) {
327 qmlWarning(this) << "setPaused() cannot be used on non-root animation nodes.";
328 return;
329 }
330
331 d->paused = p;
332
333 if (!d->componentComplete || !d->animationInstance)
334 return;
335
336 if (d->paused)
337 d->animationInstance->pause();
338 else
339 d->animationInstance->resume();
340
341 emit pausedChanged(d->paused);
342}
343
345{
347 d->componentComplete = false;
348}
349
351{
353 d->componentComplete = true;
354 if (d->needsDeferredSetRunning) {
355 if (d->running) {
356 d->running = false;
357 setRunning(true);
358 }
359 if (d->paused) {
360 d->paused = false;
361 setPaused(true);
362 }
363 }
364}
365
383{
384 Q_D(const QQuickAbstractAnimation);
385 return d->alwaysRunToEnd;
386}
387
389{
391 if (d->alwaysRunToEnd == f)
392 return;
393
394 d->alwaysRunToEnd = f;
396}
397
422{
423 Q_D(const QQuickAbstractAnimation);
424 return d->loopCount;
425}
426
428{
430 if (loops < 0)
431 loops = -1;
432
433 if (loops == d->loopCount)
434 return;
435
436 d->loopCount = loops;
438}
439
441{
442 Q_D(const QQuickAbstractAnimation);
443 return d->animationInstance ? d->animationInstance->duration() : 0;
444}
445
447{
449 return d->animationInstance ? d->animationInstance->currentLoopTime() : 0;
450}
451
453{
455 if (d->animationInstance)
456 d->animationInstance->setCurrentTime(time);
457 //TODO save value for start?
458}
459
461{
462 Q_D(const QQuickAbstractAnimation);
463 return d->group;
464}
465
467{
469 if (d->group == g)
470 return;
471 if (d->group)
472 d->group->d_func()->animations.removeAll(this);
473
474 d->group = g;
475
476 if (d->group && !d->group->d_func()->animations.contains(this)) {
477 if (index >= 0)
478 d->group->d_func()->animations.insert(index, this);
479 else
480 d->group->d_func()->animations.append(this);
481 }
482}
483
492{
493 setRunning(true);
494}
495
504{
505 setPaused(true);
506}
507
516{
517 setPaused(false);
518}
519
541{
542 setRunning(false);
543}
544
553{
554 stop();
555 start();
556}
557
577{
579 if (isRunning() && d->animationInstance) {
580 d->animationInstance->setCurrentTime(d->animationInstance->duration());
581 }
582}
583
585{
587 d->defaultProperty = p;
588
589 if (!d->avoidPropertyValueSourceStart)
590 setRunning(true);
591}
592
593/*
594 we rely on setTarget only being called when used as a value source
595 so this function allows us to do the same thing as setTarget without
596 that assumption
597*/
599{
601 d->defaultProperty = p;
602}
603
604/*
605 don't allow start/stop/pause/resume to be manually invoked,
606 because something else (like a Behavior) already has control
607 over the animation.
608*/
610{
612 d->disableUserControl = true;
613}
614
616{
618 d->disableUserControl = false;
619
620}
621
623{
624 Q_D(const QQuickAbstractAnimation);
625 return d->disableUserControl;
626}
627
634
636 QQmlProperties &modified,
638 QObject *defaultTarget)
639{
640 Q_UNUSED(actions);
641 Q_UNUSED(modified);
643 Q_UNUSED(defaultTarget);
644 return nullptr;
645}
646
648{
650 q->setRunning(false);
651 if (alwaysRunToEnd) {
652 emit q->stopped();
653 //restore the proper loopCount for the next run
654 if (loopCount != 1)
656 }
657 emit q->finished();
658}
659
664
691
695
703{
704 Q_D(const QQuickPauseAnimation);
705 return d->duration;
706}
707
709{
710 if (duration < 0) {
711 qmlWarning(this) << tr("Cannot set a duration of < 0");
712 return;
713 }
714
716 if (d->duration == duration)
717 return;
718 d->duration = duration;
720 if (d->group)
721 d->animationGroupDirty();
722}
723
725 QQmlProperties &modified,
727 QObject *defaultTarget)
728{
730 Q_UNUSED(actions);
731 Q_UNUSED(modified);
733 Q_UNUSED(defaultTarget);
734
735 return initInstance(new QPauseAnimationJob(d->duration));
736}
737
770{
772 d->interpolatorType = QMetaType::QColor;
773 d->defaultToInterpolatorType = true;
774 d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
775}
776
780
808{
809 Q_D(const QQuickPropertyAnimation);
810 return d->from.value<QColor>();
811}
812
817
831{
832 Q_D(const QQuickPropertyAnimation);
833 return d->to.value<QColor>();
834}
835
840
845
850
852{
853 delete animAction;
854}
855
857{
858 return 0;
859}
860
862{
863 if (isRunning())
864 stop();
865 animAction = action;
866}
867
871
873{
874 Q_UNUSED(oldState);
875
876 if (newState == Running) {
877 if (animAction) {
878 animAction->doAction();
879 }
880 }
881}
882
884{
885 d << "ActionAnimation(" << Qt::hex << (const void *) this << Qt::dec << ")";
886
887 if (animAction) {
888 int indentLevel = 1;
889 const QAbstractAnimationJob *job = this;
890 while ((job = job->group()))
891 ++indentLevel;
892 animAction->debugAction(d, indentLevel);
893 }
894}
895
929
933
936
942{
943 Q_D(const QQuickScriptAction);
944 return d->script;
945}
946
948{
950 d->script = script;
951}
952
964{
965 Q_D(const QQuickScriptAction);
966 return d->name;
967}
968
974
979
981{
983
984 if (!scriptStr.isEmpty()) {
985 QQmlExpression expr(scriptStr);
986
987 QByteArray ind(indentLevel, u' ');
988 QString exprStr = expr.expression();
989 int endOfFirstLine = exprStr.indexOf(u'\n');
990 d << "\n" << ind.constData() << QStringView{exprStr}.left(endOfFirstLine);
991 if (endOfFirstLine != -1 && endOfFirstLine < exprStr.size())
992 d << "...";
993 }
994}
995
997{
1000 return;
1001
1003
1004 if (!scriptStr.isEmpty()) {
1005 QQmlExpression expr(scriptStr);
1006 expr.evaluate();
1007 if (expr.hasError())
1008 qmlWarning(q) << expr.error();
1009 }
1010}
1011
1013 QQmlProperties &modified,
1015 QObject *defaultTarget)
1016{
1017 Q_D(QQuickScriptAction);
1018 Q_UNUSED(modified);
1019 Q_UNUSED(defaultTarget);
1020
1021 d->hasRunScriptScript = false;
1022 d->reversing = (direction == Backward);
1023 if (!d->name.isEmpty()) {
1024 for (int ii = 0; ii < actions.size(); ++ii) {
1025 QQuickStateAction &action = actions[ii];
1026
1027 if (action.event && action.event->type() == QQuickStateActionEvent::Script
1028 && static_cast<QQuickStateChangeScript*>(action.event)->name() == d->name) {
1029 d->runScriptScript = static_cast<QQuickStateChangeScript*>(action.event)->script();
1030 d->hasRunScriptScript = true;
1031 action.actionDone = true;
1032 break; //only match one (names should be unique)
1033 }
1034 }
1035 }
1036 return initInstance(new QActionAnimation(d->createAction()));
1037}
1038
1084
1088
1090{
1091 Q_D(const QQuickPropertyAction);
1092 return d->target;
1093}
1094
1096{
1098 if (d->target == o)
1099 return;
1100 d->target = o;
1102 if (d->group)
1103 d->animationGroupDirty();
1104}
1105
1107{
1108 Q_D(const QQuickPropertyAction);
1109 return d->propertyName;
1110}
1111
1113{
1115 if (d->propertyName == n)
1116 return;
1117 d->propertyName = n;
1119 if (d->group)
1120 d->animationGroupDirty();
1121}
1122
1139{
1140 Q_D(const QQuickPropertyAction);
1141 return d->properties;
1142}
1143
1145{
1147 if (d->properties == p)
1148 return;
1149 d->properties = p;
1151 if (d->group)
1152 d->animationGroupDirty();
1153}
1154
1155QQmlListProperty<QObject> QQuickPropertyAction::targets()
1156{
1158 return QQmlListProperty<QObject>(this, &(d->targets));
1159}
1160
1167QQmlListProperty<QObject> QQuickPropertyAction::exclude()
1168{
1170 return QQmlListProperty<QObject>(this, &(d->exclude));
1171}
1172
1183{
1184 Q_D(const QQuickPropertyAction);
1185 return d->value;
1186}
1187
1189{
1191 if (!d->value.isValid() || d->value != v) {
1192 d->value = v;
1194 }
1195}
1196
1198 QQmlProperties &modified,
1200 QObject *defaultTarget)
1201{
1204
1205 struct QQuickSetPropertyAnimationAction : public QAbstractAnimationAction
1206 {
1207 QQuickStateActions actions;
1208 void doAction() override
1209 {
1210 for (int ii = 0; ii < actions.size(); ++ii) {
1211 const QQuickStateAction &action = actions.at(ii);
1213 }
1214 }
1215 void debugAction(QDebug d, int indentLevel) const override {
1216 QByteArray ind(indentLevel, ' ');
1217 for (int ii = 0; ii < actions.size(); ++ii) {
1218 const QQuickStateAction &action = actions.at(ii);
1219 d << "\n" << ind.constData() << "target:" << action.property.object() << "property:" << action.property.name()
1220 << "value:" << action.toValue;
1221 }
1222 }
1223 };
1224
1225 QStringList props = d->properties.isEmpty() ? QStringList() : d->properties.split(QLatin1Char(','));
1226 for (int ii = 0; ii < props.size(); ++ii)
1227 props[ii] = props.at(ii).trimmed();
1228 if (!d->propertyName.isEmpty())
1229 props << d->propertyName;
1230
1231 QList<QObject*> targets = d->targets;
1232 if (d->target)
1233 targets.append(d->target);
1234
1235 bool hasSelectors = !props.isEmpty() || !targets.isEmpty() || !d->exclude.isEmpty();
1236
1237 if (d->defaultProperty.isValid() && !hasSelectors) {
1238 props << d->defaultProperty.name();
1239 targets << d->defaultProperty.object();
1240 }
1241
1242 if (defaultTarget && targets.isEmpty())
1243 targets << defaultTarget;
1244
1245 QQuickSetPropertyAnimationAction *data = new QQuickSetPropertyAnimationAction;
1246
1247 bool hasExplicit = false;
1248 //an explicit animation has been specified
1249 if (d->value.isValid()) {
1250 for (int i = 0; i < props.size(); ++i) {
1251 for (int j = 0; j < targets.size(); ++j) {
1253 myAction.property = d->createProperty(targets.at(j), props.at(i), this);
1254 if (myAction.property.isValid()) {
1255 myAction.toValue = d->value;
1257 data->actions << myAction;
1258 hasExplicit = true;
1259 for (int ii = 0; ii < actions.size(); ++ii) {
1260 QQuickStateAction &action = actions[ii];
1261 if (action.property.object() == myAction.property.object() &&
1262 myAction.property.name() == action.property.name()) {
1263 modified << action.property;
1264 break; //### any chance there could be multiples?
1265 }
1266 }
1267 }
1268 }
1269 }
1270 }
1271
1272 if (!hasExplicit)
1273 for (int ii = 0; ii < actions.size(); ++ii) {
1274 QQuickStateAction &action = actions[ii];
1275
1276 QObject *obj = action.property.object();
1277 QString propertyName = action.property.name();
1278 QObject *sObj = action.specifiedObject;
1279 QString sPropertyName = action.specifiedProperty;
1280 bool same = (obj == sObj);
1281
1282 if ((targets.isEmpty() || targets.contains(obj) || (!same && targets.contains(sObj))) &&
1283 (!d->exclude.contains(obj)) && (same || (!d->exclude.contains(sObj))) &&
1284 (props.contains(propertyName) || (!same && props.contains(sPropertyName)))) {
1285 QQuickStateAction myAction = action;
1286
1287 if (d->value.isValid())
1288 myAction.toValue = d->value;
1290
1291 modified << action.property;
1292 data->actions << myAction;
1293 action.fromValue = myAction.toValue;
1294 }
1295 }
1296
1297 QActionAnimation *action = new QActionAnimation;
1298 if (data->actions.size()) {
1299 action->setAnimAction(data);
1300 } else {
1301 delete data;
1302 }
1303 return initInstance(action);
1304}
1305
1339
1345
1349
1350void QQuickNumberAnimation::init()
1351{
1353 d->interpolatorType = QMetaType::QReal;
1354 d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
1355}
1356
1385{
1386 Q_D(const QQuickPropertyAnimation);
1387 return d->from.toReal();
1388}
1389
1394
1407{
1408 Q_D(const QQuickPropertyAnimation);
1409 return d->to.toReal();
1410}
1411
1416
1417
1418
1439{
1441 d->interpolatorType = QMetaType::QVector3D;
1442 d->defaultToInterpolatorType = true;
1443 d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
1444}
1445
1449
1462{
1463 Q_D(const QQuickPropertyAnimation);
1464 return d->from.value<QVector3D>();
1465}
1466
1471
1484{
1485 Q_D(const QQuickPropertyAnimation);
1486 return d->to.value<QVector3D>();
1487}
1488
1493
1494
1495
1538{
1539 qreal newt = t;
1540 qreal diff = t-f;
1541 while(diff > 180.0){
1542 newt -= 360.0;
1543 diff -= 360.0;
1544 }
1545 while(diff < -180.0){
1546 newt += 360.0;
1547 diff += 360.0;
1548 }
1549 return QVariant(f + (newt - f) * progress);
1550}
1551
1553{
1554 qreal newt = t;
1555 qreal diff = t-f;
1556 while(diff < 0.0){
1557 newt += 360.0;
1558 diff += 360.0;
1559 }
1560 return QVariant(f + (newt - f) * progress);
1561}
1562
1564{
1565 qreal newt = t;
1566 qreal diff = t-f;
1567 while(diff > 0.0){
1568 newt -= 360.0;
1569 diff -= 360.0;
1570 }
1571 return QVariant(f + (newt - f) * progress);
1572}
1573
1576{
1578 d->interpolatorType = QMetaType::QReal;
1579 d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
1580 d->defaultProperties = QLatin1String("rotation,angle");
1581}
1582
1586
1614{
1615 Q_D(const QQuickRotationAnimation);
1616 return d->from.toReal();
1617}
1618
1623
1636{
1637 Q_D(const QQuickRotationAnimation);
1638 return d->to.toReal();
1639}
1640
1645
1668
1670{
1672 if (d->direction == direction)
1673 return;
1674
1675 d->direction = direction;
1676 switch(d->direction) {
1677 case Clockwise:
1678 d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(reinterpret_cast<void *>(&_q_interpolateClockwiseRotation));
1679 break;
1680 case Counterclockwise:
1681 d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(reinterpret_cast<void *>(&_q_interpolateCounterclockwiseRotation));
1682 break;
1683 case Shortest:
1684 d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(reinterpret_cast<void *>(&_q_interpolateShortestRotation));
1685 break;
1686 default:
1687 d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
1688 break;
1689 }
1691}
1692
1693
1694
1699
1704
1705void QQuickAnimationGroupPrivate::append_animation(QQmlListProperty<QQuickAbstractAnimation> *list, QQuickAbstractAnimation *a)
1706{
1707 QQuickAnimationGroup *q = qmlobject_cast<QQuickAnimationGroup *>(list->object);
1708 if (q && a)
1709 a->setGroup(q);
1710}
1711
1713{
1714 if (auto q = qmlobject_cast<QQuickAnimationGroup *>(list->object))
1715 return q->d_func()->animations.at(index);
1716 return nullptr;
1717}
1718
1719qsizetype QQuickAnimationGroupPrivate::count_animation(QQmlListProperty<QQuickAbstractAnimation> *list)
1720{
1721 if (auto q = qmlobject_cast<QQuickAnimationGroup *>(list->object))
1722 return q->d_func()->animations.size();
1723 return 0;
1724}
1725
1726void QQuickAnimationGroupPrivate::clear_animation(QQmlListProperty<QQuickAbstractAnimation> *list)
1727{
1728 QQuickAnimationGroup *q = qobject_cast<QQuickAnimationGroup *>(list->object);
1729 if (q) {
1730 while (q->d_func()->animations.size()) {
1731 QQuickAbstractAnimation *firstAnim = q->d_func()->animations.at(0);
1732 firstAnim->setGroup(nullptr);
1733 }
1734 }
1735}
1736
1737void QQuickAnimationGroupPrivate::replace_animation(QQmlListProperty<QQuickAbstractAnimation> *list,
1739{
1740 if (auto *q = qmlobject_cast<QQuickAnimationGroup *>(list->object)) {
1741 if (QQuickAbstractAnimation *anim = q->d_func()->animations.at(i))
1742 anim->setGroup(nullptr);
1743 if (a)
1744 a->setGroup(q, i);
1745 }
1746}
1747
1748void QQuickAnimationGroupPrivate::removeLast_animation(QQmlListProperty<QQuickAbstractAnimation> *list)
1749{
1750 if (auto *q = qobject_cast<QQuickAnimationGroup *>(list->object))
1751 q->d_func()->animations.last()->setGroup(nullptr);
1752}
1753
1755{
1757 if (!animationDirty)
1758 return;
1759
1760 animationDirty = false;
1761
1763 const int currentLoop = animationInstance->currentLoop();
1764
1765 QSignalBlocker signalBlocker(q);
1766 q->stop();
1767 q->start();
1768
1770 // Restarting adjusts animationInstance's loopCount
1771 // Since we just want to start it from this loop,
1772 // it will be restored again.
1773 if (loopCount != -1)
1775}
1776
1783
1785{
1787 for (int i = 0; i < d->animations.size(); ++i)
1788 d->animations.at(i)->d_func()->group = nullptr;
1789 d->animations.clear();
1790}
1791
1792QQmlListProperty<QQuickAbstractAnimation> QQuickAnimationGroup::animations()
1793{
1795 return QQmlListProperty<QQuickAbstractAnimation>(
1796 this, &(d->animations),
1803}
1804
1843
1847
1849{
1850 Q_D(const QQuickAnimationGroup);
1851
1852 ThreadingModel style = AnyThread;
1853 for (int i=0; i<d->animations.size(); ++i) {
1854 ThreadingModel ces = d->animations.at(i)->threadingModel();
1855 if (ces == GuiThread)
1856 return GuiThread;
1857 else if (ces == RenderThread)
1858 style = RenderThread;
1859 }
1860 return style;
1861}
1862
1864 QQmlProperties &modified,
1866 QObject *defaultTarget)
1867{
1869
1871
1872 int inc = 1;
1873 int from = 0;
1874 if (direction == Backward) {
1875 inc = -1;
1876 from = d->animations.size() - 1;
1877 }
1878
1879 ThreadingModel execution = threadingModel();
1880
1881 bool valid = d->defaultProperty.isValid();
1883 for (int ii = from; ii < d->animations.size() && ii >= 0; ii += inc) {
1884 if (valid)
1885 d->animations.at(ii)->setDefaultTarget(d->defaultProperty);
1886 anim = d->animations.at(ii)->transition(actions, modified, direction, defaultTarget);
1887 if (anim) {
1888 if (d->animations.at(ii)->threadingModel() == RenderThread && execution != RenderThread)
1889 anim = new QQuickAnimatorProxyJob(anim, this);
1890 inc == -1 ? ag->prependAnimation(anim) : ag->appendAnimation(anim);
1891 }
1892 }
1893
1894 return initInstance(ag);
1895}
1896
1897
1898
1932
1936
1938{
1939 Q_D(const QQuickAnimationGroup);
1940
1941 ThreadingModel style = AnyThread;
1942 for (int i=0; i<d->animations.size(); ++i) {
1943 ThreadingModel ces = d->animations.at(i)->threadingModel();
1944 if (ces == GuiThread)
1945 return GuiThread;
1946 else if (ces == RenderThread)
1947 style = RenderThread;
1948 }
1949 return style;
1950}
1951
1952
1953
1955 QQmlProperties &modified,
1957 QObject *defaultTarget)
1958{
1961
1963
1964 bool valid = d->defaultProperty.isValid();
1966 for (int ii = 0; ii < d->animations.size(); ++ii) {
1967 if (valid)
1968 d->animations.at(ii)->setDefaultTarget(d->defaultProperty);
1969 anim = d->animations.at(ii)->transition(actions, modified, direction, defaultTarget);
1970 if (anim) {
1971 if (d->animations.at(ii)->threadingModel() == RenderThread && style != RenderThread)
1972 anim = new QQuickAnimatorProxyJob(anim, this);
1973 ag->appendAnimation(anim);
1974 }
1975 }
1976 return initInstance(ag);
1977}
1978
1980{
1982 // We listen to current loop changes in order to restart the animation if e.g. from, to, etc.
1983 // are modified while the animation is running.
1984 // Restarting is a bit drastic but there is a lot of stuff that commence() (and therefore
1985 // QQuickPropertyAnimation::transition() and QQuickPropertyAnimation::createTransitionActions())
1986 // does, so we want to avoid trying to take a shortcut and just restart the whole thing.
1987 if (ourPropertiesDirty) {
1988 ourPropertiesDirty = false;
1989
1990 // We use animationInstance everywhere for simplicity - if we defined the job parameter
1991 // it would be deleted as soon as we call stop().
1993 const int currentLoop = animationInstance->currentLoop();
1994
1995 QSignalBlocker signalBlocker(q);
1996 q->stop();
1997 q->start();
1998
2000 // We multiply it ourselves here instead of just saving currentTime(), because otherwise
2001 // it seems to accumulate, and changing our properties while the animation is running
2002 // can result in the animation starting mid-way through a loop, which is not we want;
2003 // we want it to start from the beginning.
2005 }
2006}
2007
2008//convert a variant from string type to another animatable type
2010{
2011 if (variant.userType() != QMetaType::QString) {
2013 return;
2014 }
2015
2016 switch (type.id()) {
2017 case QMetaType::QRect:
2018 case QMetaType::QRectF:
2019 case QMetaType::QPoint:
2020 case QMetaType::QPointF:
2021 case QMetaType::QSize:
2022 case QMetaType::QSizeF:
2023 case QMetaType::QColor:
2024 case QMetaType::QVector3D:
2025 {
2026 bool ok = false;
2028 }
2029 break;
2030 default:
2033 }
2034 break;
2035 }
2036}
2037
2039 : QAbstractAnimationJob(), animValue(nullptr), fromIsSourced(nullptr), m_duration(250)
2040{
2041}
2042
2044{
2045 delete animValue;
2046}
2047
2049{
2050 if (isRunning())
2051 stop();
2052 animValue = value;
2053}
2054
2056{
2057 if (isStopped())
2058 return;
2059
2060 const qreal progress = easing.valueForProgress(((m_duration == 0) ? qreal(1) : qreal(currentTime) / qreal(m_duration)));
2061
2062 if (animValue)
2063 animValue->setValue(progress);
2064}
2065
2067{
2068 // Check for new "from" value only when animation has one loop.
2069 // Otherwise use the initial "from" value for every iteration.
2070 if (m_loopCount == 1 && fromIsSourced)
2071 *fromIsSourced = false;
2073}
2074
2076{
2077 d << "BulkValueAnimation(" << Qt::hex << (const void *) this << Qt::dec << ")" << "duration:" << duration();
2078
2079 if (animValue) {
2080 int indentLevel = 1;
2081 const QAbstractAnimationJob *job = this;
2082 while ((job = job->group()))
2083 ++indentLevel;
2084 animValue->debugUpdater(d, indentLevel);
2085 }
2086}
2087
2161
2166
2170
2178{
2179 Q_D(const QQuickPropertyAnimation);
2180 return d->duration;
2181}
2182
2184{
2185 if (duration < 0) {
2186 qmlWarning(this) << tr("Cannot set a duration of < 0");
2187 return;
2188 }
2189
2191 if (d->duration == duration)
2192 return;
2193 d->duration = duration;
2194 if (d->componentComplete && d->running)
2195 d->ourPropertiesDirty = true;
2197 if (d->group)
2198 d->animationGroupDirty();
2199}
2200
2213{
2214 Q_D(const QQuickPropertyAnimation);
2215 return d->from;
2216}
2217
2219{
2221 if (d->fromIsDefined && f == d->from)
2222 return;
2223 d->from = f;
2224 d->fromIsDefined = f.isValid();
2225 if (d->componentComplete && d->running)
2226 d->ourPropertiesDirty = true;
2227 emit fromChanged();
2228 if (d->group)
2229 d->animationGroupDirty();
2230}
2231
2244{
2245 Q_D(const QQuickPropertyAnimation);
2246 return d->to;
2247}
2248
2250{
2252 if (d->toIsDefined && t == d->to)
2253 return;
2254 d->to = t;
2255 d->toIsDefined = t.isValid();
2256 if (d->componentComplete && d->running)
2257 d->ourPropertiesDirty = true;
2258 emit toChanged();
2259 if (d->group)
2260 d->animationGroupDirty();
2261}
2262
2272
2476
2478{
2479 Q_D(const QQuickPropertyAnimation);
2480 return d->easing;
2481}
2482
2484{
2486 if (d->easing == e)
2487 return;
2488
2489 d->easing = e;
2490 if (d->componentComplete && d->running)
2491 d->ourPropertiesDirty = true;
2493 if (d->group)
2494 d->animationGroupDirty();
2495}
2496
2498{
2499 Q_D(const QQuickPropertyAnimation);
2500 return d->target;
2501}
2502
2504{
2506 if (d->target == o)
2507 return;
2508 d->target = o;
2510 if (d->group)
2511 d->animationGroupDirty();
2512}
2513
2515{
2516 Q_D(const QQuickPropertyAnimation);
2517 return d->propertyName;
2518}
2519
2521{
2523 if (d->propertyName == n)
2524 return;
2525 d->propertyName = n;
2527 if (d->group)
2528 d->animationGroupDirty();
2529}
2530
2532{
2533 Q_D(const QQuickPropertyAnimation);
2534 return d->properties;
2535}
2536
2538{
2540 if (d->properties == prop)
2541 return;
2542
2543 d->properties = prop;
2544 emit propertiesChanged(prop);
2545 if (d->group)
2546 d->animationGroupDirty();
2547}
2548
2649QQmlListProperty<QObject> QQuickPropertyAnimation::targets()
2650{
2652 using ListPtr = QList<QPointer<QObject>> *;
2653 using LP = QQmlListProperty<QObject>;
2654 LP::AppendFunction appendFn = [](LP *prop, QObject *value)
2655 {
2656 static_cast<ListPtr>(prop->data)->append(value);
2657 };
2658 LP::CountFunction countFn = [](LP *prop)
2659 {
2660 return static_cast<ListPtr>(prop->data)->size();
2661 };
2662
2663 LP::AtFunction atFn = [](LP *prop, qsizetype index) -> QObject *
2664 {
2665 return static_cast<ListPtr>(prop->data)->at(index);
2666 };
2667
2668 LP::ClearFunction clearFN = [](LP *prop)
2669 {
2670 return static_cast<ListPtr>(prop->data)->clear();
2671 };
2672
2673 LP::ReplaceFunction replaceFn = [](LP *prop, qsizetype index, QObject *value)
2674 {
2675 static_cast<ListPtr>(prop->data)->replace(index, value);
2676 };
2677
2678 LP::RemoveLastFunction removeLastFn = [](LP *prop)
2679 {
2680 static_cast<ListPtr>(prop->data)->removeLast();
2681 };
2682
2683 return QQmlListProperty<QObject>(this, &(d->targets), appendFn, countFn, atFn, clearFN, replaceFn, removeLastFn);
2684}
2685
2691QQmlListProperty<QObject> QQuickPropertyAnimation::exclude()
2692{
2694 return QQmlListProperty<QObject>(this, &(d->exclude));
2695}
2696
2698{
2699 bool deleted = false;
2700 wasDeleted = &deleted;
2701 if (reverse)
2702 v = 1 - v;
2703 for (int ii = 0; ii < actions.size(); ++ii) {
2704 QQuickStateAction &action = actions[ii];
2705
2706 if (v == 1.) {
2708 } else {
2709 if (!fromIsSourced && !fromIsDefined) {
2710 action.fromValue = action.property.read();
2711 if (interpolatorType) {
2713 }
2714 }
2715 if (!interpolatorType) {
2716 int propType = action.property.propertyType();
2717 if (!prevInterpolatorType || prevInterpolatorType != propType) {
2718 prevInterpolatorType = propType;
2720 }
2721 }
2722 if (interpolator)
2724 }
2725 if (deleted)
2726 return;
2727 }
2728 wasDeleted = nullptr;
2729 fromIsSourced = true;
2730}
2731
2733{
2734 QByteArray ind(indentLevel, ' ');
2735 for (int i = 0; i < actions.size(); ++i) {
2736 const QQuickStateAction &action = actions.at(i);
2737 d << "\n" << ind.constData() << "target:" << action.property.object() << "property:" << action.property.name()
2738 << "from:" << action.fromValue << "to:" << action.toValue;
2739 }
2740}
2741
2743 QQmlProperties &modified,
2744 QObject *defaultTarget)
2745{
2747 QQuickStateActions newActions;
2748
2749 QStringList props = d->properties.isEmpty() ? QStringList() : d->properties.split(QLatin1Char(','));
2750 for (int ii = 0; ii < props.size(); ++ii)
2751 props[ii] = props.at(ii).trimmed();
2752 if (!d->propertyName.isEmpty())
2753 props << d->propertyName;
2754
2755 QList<QPointer<QObject>> targets = d->targets;
2756 if (d->target)
2757 targets.append(d->target);
2758
2759 bool hasSelectors = !props.isEmpty() || !targets.isEmpty() || !d->exclude.isEmpty();
2760 bool useType = (props.isEmpty() && d->defaultToInterpolatorType) ? true : false;
2761
2762 if (d->defaultProperty.isValid() && !hasSelectors) {
2763 props << d->defaultProperty.name();
2764 targets << d->defaultProperty.object();
2765 }
2766
2767 if (defaultTarget && targets.isEmpty())
2768 targets << defaultTarget;
2769
2770 bool usingDefaultProperties = false;
2771 if (props.isEmpty() && !d->defaultProperties.isEmpty()) {
2772 props << d->defaultProperties.split(QLatin1Char(','));
2773 usingDefaultProperties = true;
2774 }
2775
2776 bool hasExplicit = false;
2777 //an explicit animation has been specified
2778 if (d->toIsDefined) {
2779 QVector<QString> errorMessages;
2780 bool successfullyCreatedDefaultProperty = false;
2781
2782 for (int i = 0; i < props.size(); ++i) {
2783 for (int j = 0; j < targets.size(); ++j) {
2784 const auto& guarded = targets.at(j);
2785 if (guarded.isNull())
2786 continue;
2787 QObject *target = guarded.get();
2790 const QString &propertyName = props.at(i);
2791 myAction.property = d->createProperty(target, propertyName, this, &errorMessage);
2792 if (myAction.property.isValid()) {
2793 if (usingDefaultProperties)
2794 successfullyCreatedDefaultProperty = true;
2795
2796 if (d->fromIsDefined) {
2797 myAction.fromValue = d->from;
2798 d->convertVariant(myAction.fromValue, d->interpolatorType ? QMetaType(d->interpolatorType) : myAction.property.propertyMetaType());
2799 }
2800 myAction.toValue = d->to;
2801 d->convertVariant(myAction.toValue, d->interpolatorType ? QMetaType(d->interpolatorType) : myAction.property.propertyMetaType());
2802 newActions << myAction;
2803 hasExplicit = true;
2804 for (int ii = 0; ii < actions.size(); ++ii) {
2805 QQuickStateAction &action = actions[ii];
2806 if (action.property.object() == myAction.property.object() &&
2807 myAction.property.name() == action.property.name()) {
2808 modified << action.property;
2809 break; //### any chance there could be multiples?
2810 }
2811 }
2812 } else {
2814 }
2815 }
2816 }
2817
2818 if (!successfullyCreatedDefaultProperty) {
2819 for (const QString &errorMessage : std::as_const(errorMessages))
2820 qmlWarning(this) << errorMessage;
2821 }
2822 }
2823
2824 if (!hasExplicit)
2825 for (int ii = 0; ii < actions.size(); ++ii) {
2826 QQuickStateAction &action = actions[ii];
2827
2828 QObject *obj = action.property.object();
2829 QString propertyName = action.property.name();
2830 QObject *sObj = action.specifiedObject;
2831 QString sPropertyName = action.specifiedProperty;
2832 bool same = (obj == sObj);
2833
2834 if ((targets.isEmpty() || targets.contains(obj) || (!same && targets.contains(sObj))) &&
2835 (!d->exclude.contains(obj)) && (same || (!d->exclude.contains(sObj))) &&
2836 (props.contains(propertyName) || (!same && props.contains(sPropertyName))
2837 || (useType && action.property.propertyType() == d->interpolatorType))) {
2838 QQuickStateAction myAction = action;
2839
2840 if (d->fromIsDefined)
2841 myAction.fromValue = d->from;
2842 else
2843 myAction.fromValue = QVariant();
2844 if (d->toIsDefined)
2845 myAction.toValue = d->to;
2846
2847 d->convertVariant(myAction.fromValue, d->interpolatorType ? QMetaType(d->interpolatorType) : myAction.property.propertyMetaType());
2848 d->convertVariant(myAction.toValue, d->interpolatorType ? QMetaType(d->interpolatorType) : myAction.property.propertyMetaType());
2849
2850 modified << action.property;
2851
2852 newActions << myAction;
2853 action.fromValue = myAction.toValue;
2854 }
2855 }
2856 return newActions;
2857}
2858
2860 QQmlProperties &modified,
2862 QObject *defaultTarget)
2863{
2865
2866 QQuickStateActions dataActions = createTransitionActions(actions, modified, defaultTarget);
2867
2869 animator->setDuration(d->duration);
2870 animator->setEasingCurve(d->easing);
2871
2872 if (!dataActions.isEmpty()) {
2874 data->interpolatorType = d->interpolatorType;
2875 data->interpolator = d->interpolator;
2876 data->reverse = direction == Backward ? true : false;
2877 data->fromIsSourced = false;
2878 data->fromIsDefined = d->fromIsDefined;
2879 data->actions = dataActions;
2880 animator->setAnimValue(data);
2881 animator->setFromIsSourcedValue(&data->fromIsSourced);
2882 d->actions = &data->actions; //remove this?
2883 }
2884
2885 return initInstance(animator);
2886}
2887
2892
2894
2895#include "moc_qquickanimation_p.cpp"
virtual void debugAction(QDebug, int) const
virtual void doAction()=0
void addAnimationChangeListener(QAnimationJobChangeListener *listener, QAbstractAnimationJob::ChangeTypes)
void setLoopCount(int loopCount)
QAnimationGroupJob * group() const
virtual void topLevelAnimationLoopChanged()
void setLoopCount(int loopCount)
void debugAnimation(QDebug d) const override
int duration() const override
~QActionAnimation() override
void setAnimAction(QAbstractAnimationAction *action)
void updateCurrentTime(int) override
void updateState(State newState, State oldState) override
\inmodule QtCore
Definition qbytearray.h:57
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
Definition qbytearray.h:124
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtCore
\inmodule QtCore
qreal valueForProgress(qreal progress) const
Return the effective progress for the easing curve at progress.
qsizetype size() const noexcept
Definition qlist.h:397
const_reference at(qsizetype i) const noexcept
Definition qlist.h:446
\inmodule QtCore
Definition qmetatype.h:341
static QObjectPrivate * get(QObject *o)
Definition qobject_p.h:150
\inmodule QtCore
Definition qobject.h:103
QVariant property(const char *name) const
Returns the value of the object's name property.
Definition qobject.cpp:4323
The QQmlExpression class evaluates JavaScript in a QML context.
QString expression() const
Returns the expression string.
QQmlError error() const
Return any error from the last call to evaluate().
bool hasError() const
Returns true if the last call to evaluate() resulted in an error, otherwise false.
QVariant evaluate(bool *valueIsUndefined=nullptr)
Evaulates the expression, returning the result of the evaluation, or an invalid QVariant if the expre...
AtFunction at
Definition qqmllist.h:86
AppendFunction append
Definition qqmllist.h:84
static bool isValueType(QMetaType type)
static bool write(QObject *, const QQmlPropertyData &, const QVariant &, const QQmlRefPointer< QQmlContextData > &, QQmlPropertyData::WriteFlags flags={})
The QQmlProperty class abstracts accessing properties on objects created from QML.
bool isValid() const
Returns true if the QQmlProperty refers to a valid property, otherwise false.
QVariant read() const
Returns the property value.
QML_ANONYMOUSQObject * object
bool isWritable() const
Returns true if the property is writable, otherwise false.
int propertyType() const
Returns the metatype id of the property, or QMetaType::UnknownType if the property has no metatype.
The QQmlScriptString class encapsulates a script and its context.
void animationFinished(QAbstractAnimationJob *) override
QAbstractAnimationJob * animationInstance
static QQmlProperty createProperty(QObject *obj, const QString &str, QObject *infoObj, QString *errorMessage=nullptr)
QQuickAbstractAnimation(QObject *parent=nullptr)
\qmltype Animation \instantiates QQuickAbstractAnimation \inqmlmodule QtQuick
void start()
\qmlmethod QtQuick::Animation::start()
bool isRunning() const
\qmlproperty bool QtQuick::Animation::running This property holds whether the animation is currently ...
void setDefaultTarget(const QQmlProperty &)
void classBegin() override
Invoked after class creation, but before any properties have been set.
void alwaysRunToEndChanged(bool)
void complete()
\qmlmethod QtQuick::Animation::complete()
void restart()
\qmlmethod QtQuick::Animation::restart()
void stop()
\qmlmethod QtQuick::Animation::stop()
virtual QAbstractAnimationJob * transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, QObject *defaultTarget=nullptr)
virtual ThreadingModel threadingModel() const
QQuickAnimationGroup * group() const
QAbstractAnimationJob * qtAnimation()
void pause()
\qmlmethod QtQuick::Animation::pause()
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
QAbstractAnimationJob * initInstance(QAbstractAnimationJob *animation)
void resume()
\qmlmethod QtQuick::Animation::resume()
bool isPaused() const
\qmlproperty bool QtQuick::Animation::paused This property holds whether the animation is currently p...
void setGroup(QQuickAnimationGroup *, int index=-1)
void setTarget(const QQmlProperty &) override
Set the target property for the value source.
void setRunning(bool)
\qmlsignal QtQuick::Animation::started()
static qsizetype count_animation(QQmlListProperty< QQuickAbstractAnimation > *list)
void animationCurrentLoopChanged(QAbstractAnimationJob *job) override
static void replace_animation(QQmlListProperty< QQuickAbstractAnimation > *list, qsizetype index, QQuickAbstractAnimation *role)
static void removeLast_animation(QQmlListProperty< QQuickAbstractAnimation > *list)
static QQuickAbstractAnimation * at_animation(QQmlListProperty< QQuickAbstractAnimation > *list, qsizetype index)
static void clear_animation(QQmlListProperty< QQuickAbstractAnimation > *list)
static void append_animation(QQmlListProperty< QQuickAbstractAnimation > *list, QQuickAbstractAnimation *role)
QQmlListProperty< QQuickAbstractAnimation > animations
QVariantAnimation::Interpolator interpolator
void debugUpdater(QDebug d, int indentLevel) const override
void updateCurrentTime(int currentTime) override
int duration() const override
void setAnimValue(QQuickBulkValueUpdater *value)
void debugAnimation(QDebug d) const override
void topLevelAnimationLoopChanged() override
virtual void debugUpdater(QDebug, int) const
virtual void setValue(qreal value)=0
QQuickColorAnimation(QObject *parent=nullptr)
\qmltype ColorAnimation \instantiates QQuickColorAnimation \inqmlmodule QtQuick\inherits PropertyAnim...
void setFrom(const QColor &)
void setTo(const QColor &)
QQuickNumberAnimation(QObject *parent=nullptr)
\qmltype NumberAnimation \instantiates QQuickNumberAnimation \inqmlmodule QtQuick\inherits PropertyAn...
QAbstractAnimationJob * transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, QObject *defaultTarget=nullptr) override
ThreadingModel threadingModel() const override
QQuickParallelAnimation(QObject *parent=nullptr)
\qmltype ParallelAnimation \instantiates QQuickParallelAnimation \inqmlmodule QtQuick\inherits Animat...
QAbstractAnimationJob * transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, QObject *defaultTarget=nullptr) override
QQuickPauseAnimation(QObject *parent=nullptr)
\qmltype PauseAnimation \instantiates QQuickPauseAnimation \inqmlmodule QtQuick\inherits Animation
void durationChanged(int)
void setTargetObject(QObject *)
QQmlListProperty< QObject > targets
QAbstractAnimationJob * transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, QObject *defaultTarget=nullptr) override
QQuickPropertyAction(QObject *parent=nullptr)
\qmltype PropertyAction \instantiates QQuickPropertyAction \inqmlmodule QtQuick\inherits Animation
void propertiesChanged(const QString &)
QQmlListProperty< QObject > exclude
\qmlproperty list<QtObject> QtQuick::PropertyAction::exclude This property holds the objects that sho...
void setValue(const QVariant &)
void setProperties(const QString &)
void setProperty(const QString &)
void valueChanged(const QVariant &)
static void convertVariant(QVariant &variant, QMetaType type)
void animationCurrentLoopChanged(QAbstractAnimationJob *job) override
void setFrom(const QVariant &)
QQmlListProperty< QObject > targets
void easingChanged(const QEasingCurve &)
void setTo(const QVariant &)
void setEasing(const QEasingCurve &)
QQuickPropertyAnimation(QObject *parent=nullptr)
\qmltype PropertyAnimation \instantiates QQuickPropertyAnimation \inqmlmodule QtQuick\inherits Animat...
void setProperties(const QString &)
virtual void setDuration(int)
void setProperty(const QString &)
QAbstractAnimationJob * transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, QObject *defaultTarget=nullptr) override
QQuickStateActions createTransitionActions(QQuickStateActions &actions, QQmlProperties &modified, QObject *defaultTarget=nullptr)
QQmlListProperty< QObject > exclude
\qmlproperty list<QtObject> QtQuick::PropertyAnimation::exclude This property holds the items not to ...
void propertiesChanged(const QString &)
QQuickRotationAnimation(QObject *parent=nullptr)
RotationDirection direction
void setDirection(RotationDirection direction)
QAbstractAnimationAction * createAction()
QAnimationActionProxy< QQuickScriptActionPrivate, &QQuickScriptActionPrivate::execute, &QQuickScriptActionPrivate::debugAction > Proxy
void debugAction(QDebug d, int indentLevel) const
QString stateChangeScriptName() const
\qmlproperty string QtQuick::ScriptAction::scriptName This property holds the name of the StateChange...
void setStateChangeScriptName(const QString &)
QQmlScriptString script
void setScript(const QQmlScriptString &)
QQuickScriptAction(QObject *parent=nullptr)
QAbstractAnimationJob * transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, QObject *defaultTarget=nullptr) override
QQuickSequentialAnimation(QObject *parent=nullptr)
\qmltype SequentialAnimation \instantiates QQuickSequentialAnimation \inqmlmodule QtQuick\inherits An...
ThreadingModel threadingModel() const override
QAbstractAnimationJob * transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, QObject *defaultTarget=nullptr) override
virtual EventType type() const =0
QQmlProperty property
QObject * specifiedObject
QQuickStateActionEvent * event
QString specifiedProperty
QQuickVector3dAnimation(QObject *parent=nullptr)
\qmltype Vector3dAnimation \instantiates QQuickVector3dAnimation \inqmlmodule QtQuick\inherits Proper...
Exception-safe wrapper around QObject::blockSignals().
Definition qobject.h:483
\inmodule QtCore
\inmodule QtCore
Definition qstringview.h:78
constexpr QStringView left(qsizetype n) const noexcept
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
qsizetype indexOf(QLatin1StringView s, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition qstring.cpp:4517
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
Definition qstring.cpp:8870
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
Definition qstring.h:1226
static Q_CORE_EXPORT QVariantAnimation::Interpolator getInterpolator(int interpolationType)
QVariant(* Interpolator)(const void *from, const void *to, qreal progress)
\inmodule QtCore
Definition qvariant.h:65
bool convert(QMetaType type)
Casts the variant to the requested type, targetType.
bool isValid() const
Returns true if the storage type of this variant is not QMetaType::UnknownType; otherwise returns fal...
Definition qvariant.h:714
int userType() const
Definition qvariant.h:339
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
const void * constData() const
Definition qvariant.h:451
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
QString str
[2]
b clear()
list append(new Employee("Blackpool", "Stephen"))
direction
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
Q_QML_EXPORT QVariant variantFromString(const QString &, QMetaType preferredType, bool *ok=nullptr)
Combined button and popup list for selecting options.
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
QTextStream & dec(QTextStream &stream)
Calls QTextStream::setIntegerBase(10) on stream and returns stream.
QList< QString > QStringList
Constructs a string list that contains the given string, str.
static const QCssKnownValue properties[NumProperties - 1]
static QT_BEGIN_NAMESPACE constexpr const auto errorMessages
static Q_CONSTINIT QBasicAtomicInt running
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint index
[2]
GLboolean r
[2]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat f
GLenum type
GLboolean GLuint group
GLenum target
GLuint GLsizei const GLchar * message
GLenum GLuint GLsizei const GLenum * props
GLboolean GLboolean g
GLuint name
GLfloat n
GLhandleARB obj
[2]
GLdouble GLdouble t
Definition qopenglext.h:243
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLfloat GLfloat p
[1]
QQmlContext * qmlContext(const QObject *obj)
Definition qqml.cpp:75
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
QVariant _q_interpolateClockwiseRotation(qreal &f, qreal &t, qreal progress)
QVariant _q_interpolateShortestRotation(qreal &f, qreal &t, qreal progress)
\qmltype RotationAnimation \instantiates QQuickRotationAnimation \inqmlmodule QtQuick\inherits Proper...
QVariant _q_interpolateCounterclockwiseRotation(qreal &f, qreal &t, qreal progress)
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
QLatin1StringView QLatin1String
Definition qstringfwd.h:31
#define tr(X)
#define emit
#define Q_UNUSED(x)
ptrdiff_t qsizetype
Definition qtypes.h:165
double qreal
Definition qtypes.h:187
static QString errorMessage(QUrlPrivate::ErrorCode errorCode, const QString &errorSource, qsizetype errorPosition)
Definition qurl.cpp:3517
static double currentTime()
QList< int > list
[14]
QObject::connect nullptr
QVariant variant
[1]
QPropertyAnimation animation
[0]
QAction * myAction
QAction * at
\inmodule QtCore \reentrant
Definition qchar.h:18