Qt 4.8
qdeclarativeanimation.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtDeclarative module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "private/qdeclarativeanimation_p.h"
43 #include "private/qdeclarativeanimation_p_p.h"
44 
45 #include "private/qdeclarativebehavior_p.h"
46 #include "private/qdeclarativestateoperations_p.h"
47 #include "private/qdeclarativecontext_p.h"
48 
50 #include <qdeclarative.h>
51 #include <qdeclarativeinfo.h>
52 #include <qdeclarativeexpression.h>
54 #include <qdeclarativeglobal_p.h>
55 #include <qdeclarativemetatype_p.h>
57 #include <qdeclarativeproperty_p.h>
58 #include <qdeclarativeengine_p.h>
59 
60 #include <qvariant.h>
61 #include <qcolor.h>
62 #include <qfile.h>
63 #include <QParallelAnimationGroup>
64 #include <QSequentialAnimationGroup>
65 #include <QtCore/qset.h>
66 #include <QtCore/qrect.h>
67 #include <QtCore/qpoint.h>
68 #include <QtCore/qsize.h>
69 #include <QtCore/qmath.h>
70 
71 #include <private/qvariantanimation_p.h>
72 
74 
92 {
93 }
94 
96 {
97 }
98 
100 : QObject(dd, parent)
101 {
102 }
103 
142 {
144  return d->running;
145 }
146 
147 // the behavior calls this function
149 {
151  if (d->disableUserControl && d->running != running) {
152  d->running = running;
153  emit runningChanged(running);
154  }
155 }
156 
157 //commence is called to start an animation when it is used as a
158 //simple animation, and not as part of a transition
160 {
162 
163  QDeclarativeStateActions actions;
165  q->transition(actions, properties, QDeclarativeAbstractAnimation::Forward);
166 
167  q->qtAnimation()->start();
168  if (q->qtAnimation()->state() != QAbstractAnimation::Running) {
169  running = false;
170  emit q->completed();
171  }
172 }
173 
175 {
176  QDeclarativeProperty prop(obj, str, qmlContext(infoObj));
177  if (!prop.isValid()) {
178  qmlInfo(infoObj) << QDeclarativeAbstractAnimation::tr("Cannot animate non-existent property \"%1\"").arg(str);
179  return QDeclarativeProperty();
180  } else if (!prop.isWritable()) {
181  qmlInfo(infoObj) << QDeclarativeAbstractAnimation::tr("Cannot animate read-only property \"%1\"").arg(str);
182  return QDeclarativeProperty();
183  }
184  return prop;
185 }
186 
188 {
190  if (!d->componentComplete) {
191  d->running = r;
192  if (r == false)
193  d->avoidPropertyValueSourceStart = true;
194  else if (!d->registered) {
195  d->registered = true;
197  engPriv->registerFinalizedParserStatusObject(this, this->metaObject()->indexOfSlot("componentFinalized()"));
198  }
199  return;
200  }
201 
202  if (d->running == r)
203  return;
204 
205  if (d->group || d->disableUserControl) {
206  qmlInfo(this) << "setRunning() cannot be used on non-root animation nodes.";
207  return;
208  }
209 
210  d->running = r;
211  if (d->running) {
212  bool supressStart = false;
213  if (d->alwaysRunToEnd && d->loopCount != 1
214  && qtAnimation()->state() == QAbstractAnimation::Running) {
215  //we've restarted before the final loop finished; restore proper loop count
216  if (d->loopCount == -1)
217  qtAnimation()->setLoopCount(d->loopCount);
218  else
219  qtAnimation()->setLoopCount(qtAnimation()->currentLoop() + d->loopCount);
220  supressStart = true; //we want the animation to continue, rather than restart
221  }
222 
223  if (!d->connectedTimeLine) {
224  QObject::connect(qtAnimation(), SIGNAL(finished()),
225  this, SLOT(timelineComplete()));
226  d->connectedTimeLine = true;
227  }
228  if (!supressStart)
229  d->commence();
230  emit started();
231  } else {
232  if (d->alwaysRunToEnd) {
233  if (d->loopCount != 1)
234  qtAnimation()->setLoopCount(qtAnimation()->currentLoop()+1); //finish the current loop
235  } else
236  qtAnimation()->stop();
237 
238  emit completed();
239  }
240 
241  emit runningChanged(d->running);
242 }
243 
260 {
262  return d->paused;
263 }
264 
266 {
268  if (d->paused == p)
269  return;
270 
271  if (d->group || d->disableUserControl) {
272  qmlInfo(this) << "setPaused() cannot be used on non-root animation nodes.";
273  return;
274  }
275 
276  d->paused = p;
277  if (d->paused)
278  qtAnimation()->pause();
279  else
280  qtAnimation()->resume();
281 
282  emit pausedChanged(d->paused);
283 }
284 
286 {
288  d->componentComplete = false;
289 }
290 
292 {
294  d->componentComplete = true;
295 }
296 
298 {
300  if (d->running) {
301  d->running = false;
302  setRunning(true);
303  }
304 }
305 
326 {
328  return d->alwaysRunToEnd;
329 }
330 
332 {
334  if (d->alwaysRunToEnd == f)
335  return;
336 
337  d->alwaysRunToEnd = f;
339 }
340 
368 {
370  return d->loopCount;
371 }
372 
374 {
376  if (loops < 0)
377  loops = -1;
378 
379  if (loops == d->loopCount)
380  return;
381 
382  d->loopCount = loops;
383  qtAnimation()->setLoopCount(loops);
384  emit loopCountChanged(loops);
385 }
386 
387 
389 {
390  return qtAnimation()->currentLoopTime();
391 }
392 
394 {
395  qtAnimation()->setCurrentTime(time);
396 }
397 
399 {
401  return d->group;
402 }
403 
405 {
407  if (d->group == g)
408  return;
409  if (d->group)
410  static_cast<QDeclarativeAnimationGroupPrivate *>(d->group->d_func())->animations.removeAll(this);
411 
412  d->group = g;
413 
414  if (d->group && !static_cast<QDeclarativeAnimationGroupPrivate *>(d->group->d_func())->animations.contains(this))
415  static_cast<QDeclarativeAnimationGroupPrivate *>(d->group->d_func())->animations.append(this);
416 
417  //if (g) //if removed from a group, then the group should no longer be the parent
418  setParent(g);
419 }
420 
432 {
433  setRunning(true);
434 }
435 
447 {
448  setPaused(true);
449 }
450 
462 {
463  setPaused(false);
464 }
465 
490 {
491  setRunning(false);
492 }
493 
505 {
506  stop();
507  start();
508 }
509 
532 {
533  if (isRunning()) {
534  qtAnimation()->setCurrentTime(qtAnimation()->duration());
535  }
536 }
537 
539 {
541  d->defaultProperty = p;
542 
543  if (!d->avoidPropertyValueSourceStart)
544  setRunning(true);
545 }
546 
547 /*
548  we rely on setTarget only being called when used as a value source
549  so this function allows us to do the same thing as setTarget without
550  that assumption
551 */
553 {
555  d->defaultProperty = p;
556 }
557 
558 /*
559  don't allow start/stop/pause/resume to be manually invoked,
560  because something else (like a Behavior) already has control
561  over the animation.
562 */
564 {
566  d->disableUserControl = true;
567 }
568 
570  QDeclarativeProperties &modified,
572 {
573  Q_UNUSED(actions);
574  Q_UNUSED(modified);
575  Q_UNUSED(direction);
576 }
577 
579 {
581  setRunning(false);
582  if (d->alwaysRunToEnd && d->loopCount != 1) {
583  //restore the proper loopCount for the next run
584  qtAnimation()->setLoopCount(d->loopCount);
585  }
586 }
587 
614 {
616  d->init();
617 }
618 
620 {
621 }
622 
624 {
626  pa = new QPauseAnimation;
628 }
629 
640 {
642  return d->pa->duration();
643 }
644 
646 {
647  if (duration < 0) {
648  qmlInfo(this) << tr("Cannot set a duration of < 0");
649  return;
650  }
651 
653  if (d->pa->duration() == duration)
654  return;
655  d->pa->setDuration(duration);
656  emit durationChanged(duration);
657 }
658 
660 {
662  return d->pa;
663 }
664 
699 {
701  d->interpolatorType = QMetaType::QColor;
702  d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
703  d->defaultToInterpolatorType = true;
704 }
705 
707 {
708 }
709 
740 {
742  return d->from.value<QColor>();
743 }
744 
746 {
748 }
749 
766 {
768  return d->to.value<QColor>();
769 }
770 
772 {
774 }
775 
776 
777 
811 {
813  d->init();
814 }
815 
817 {
818 }
819 
821 {
823  rsa = new QActionAnimation(&proxy);
825 }
826 
835 {
837  return d->script;
838 }
839 
841 {
843  d->script = script;
844 }
845 
860 {
862  return d->name;
863 }
864 
866 {
868  d->name = name;
869 }
870 
872 {
874  if (hasRunScriptScript && reversing)
875  return;
876 
877  QDeclarativeScriptString scriptStr = hasRunScriptScript ? runScriptScript : script;
878 
879  const QString &str = scriptStr.script();
880  if (!str.isEmpty()) {
881  QDeclarativeExpression expr(scriptStr.context(), scriptStr.scopeObject(), str);
883  if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
884  expr.setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
885  expr.evaluate();
886  if (expr.hasError())
887  qmlInfo(q) << expr.error();
888  }
889 }
890 
892  QDeclarativeProperties &modified,
894 {
896  Q_UNUSED(modified);
897 
898  d->hasRunScriptScript = false;
899  d->reversing = (direction == Backward);
900  for (int ii = 0; ii < actions.count(); ++ii) {
901  QDeclarativeAction &action = actions[ii];
902 
903  if (action.event && action.event->typeName() == QLatin1String("StateChangeScript")
904  && static_cast<QDeclarativeStateChangeScript*>(action.event)->name() == d->name) {
905  d->runScriptScript = static_cast<QDeclarativeStateChangeScript*>(action.event)->script();
906  d->hasRunScriptScript = true;
907  action.actionDone = true;
908  break; //only match one (names should be unique)
909  }
910  }
911 }
912 
914 {
916  return d->rsa;
917 }
918 
919 
920 
966 {
968  d->init();
969 }
970 
972 {
973 }
974 
976 {
978  spa = new QActionAnimation;
980 }
981 
983 {
985  return d->target;
986 }
987 
989 {
991  if (d->target == o)
992  return;
993  d->target = o;
995 }
996 
998 {
1000  return d->propertyName;
1001 }
1002 
1004 {
1006  if (d->propertyName == n)
1007  return;
1008  d->propertyName = n;
1010 }
1011 
1031 {
1033  return d->properties;
1034 }
1035 
1037 {
1039  if (d->properties == p)
1040  return;
1041  d->properties = p;
1043 }
1044 
1046 {
1048  return QDeclarativeListProperty<QObject>(this, d->targets);
1049 }
1050 
1061 {
1063  return QDeclarativeListProperty<QObject>(this, d->exclude);
1064 }
1065 
1079 {
1081  return d->value;
1082 }
1083 
1085 {
1087  if (d->value.isNull || d->value != v) {
1088  d->value = v;
1089  emit valueChanged(v);
1090  }
1091 }
1092 
1094 {
1096  return d->spa;
1097 }
1098 
1100  QDeclarativeProperties &modified,
1102 {
1104  Q_UNUSED(direction);
1105 
1106  struct QDeclarativeSetPropertyAnimationAction : public QAbstractAnimationAction
1107  {
1108  QDeclarativeStateActions actions;
1109  virtual void doAction()
1110  {
1111  for (int ii = 0; ii < actions.count(); ++ii) {
1112  const QDeclarativeAction &action = actions.at(ii);
1114  }
1115  }
1116  };
1117 
1118  QStringList props = d->properties.isEmpty() ? QStringList() : d->properties.split(QLatin1Char(','));
1119  for (int ii = 0; ii < props.count(); ++ii)
1120  props[ii] = props.at(ii).trimmed();
1121  if (!d->propertyName.isEmpty())
1122  props << d->propertyName;
1123 
1124  QList<QObject*> targets = d->targets;
1125  if (d->target)
1126  targets.append(d->target);
1127 
1128  bool hasSelectors = !props.isEmpty() || !targets.isEmpty() || !d->exclude.isEmpty();
1129 
1130  if (d->defaultProperty.isValid() && !hasSelectors) {
1131  props << d->defaultProperty.name();
1132  targets << d->defaultProperty.object();
1133  }
1134 
1135  QDeclarativeSetPropertyAnimationAction *data = new QDeclarativeSetPropertyAnimationAction;
1136 
1137  bool hasExplicit = false;
1138  //an explicit animation has been specified
1139  if (d->value.isValid()) {
1140  for (int i = 0; i < props.count(); ++i) {
1141  for (int j = 0; j < targets.count(); ++j) {
1142  QDeclarativeAction myAction;
1143  myAction.property = d->createProperty(targets.at(j), props.at(i), this);
1144  if (myAction.property.isValid()) {
1145  myAction.toValue = d->value;
1147  data->actions << myAction;
1148  hasExplicit = true;
1149  for (int ii = 0; ii < actions.count(); ++ii) {
1150  QDeclarativeAction &action = actions[ii];
1151  if (action.property.object() == myAction.property.object() &&
1152  myAction.property.name() == action.property.name()) {
1153  modified << action.property;
1154  break; //### any chance there could be multiples?
1155  }
1156  }
1157  }
1158  }
1159  }
1160  }
1161 
1162  if (!hasExplicit)
1163  for (int ii = 0; ii < actions.count(); ++ii) {
1164  QDeclarativeAction &action = actions[ii];
1165 
1166  QObject *obj = action.property.object();
1167  QString propertyName = action.property.name();
1168  QObject *sObj = action.specifiedObject;
1169  QString sPropertyName = action.specifiedProperty;
1170  bool same = (obj == sObj);
1171 
1172  if ((targets.isEmpty() || targets.contains(obj) || (!same && targets.contains(sObj))) &&
1173  (!d->exclude.contains(obj)) && (same || (!d->exclude.contains(sObj))) &&
1174  (props.contains(propertyName) || (!same && props.contains(sPropertyName)))) {
1175  QDeclarativeAction myAction = action;
1176 
1177  if (d->value.isValid())
1178  myAction.toValue = d->value;
1180 
1181  modified << action.property;
1182  data->actions << myAction;
1183  action.fromValue = myAction.toValue;
1184  }
1185  }
1186 
1187  if (data->actions.count()) {
1188  d->spa->setAnimAction(data, QAbstractAnimation::DeleteWhenStopped);
1189  } else {
1190  delete data;
1191  }
1192 }
1193 
1226 {
1227  init();
1228 }
1229 
1231 : QDeclarativePropertyAnimation(dd, parent)
1232 {
1233  init();
1234 }
1235 
1237 {
1238 }
1239 
1241 {
1243  d->interpolatorType = QMetaType::QReal;
1244  d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
1245 }
1246 
1278 {
1280  return d->from.toReal();
1281 }
1282 
1284 {
1286 }
1287 
1303 {
1305  return d->to.toReal();
1306 }
1307 
1309 {
1311 }
1312 
1313 
1314 
1337 {
1339  d->interpolatorType = QMetaType::QVector3D;
1340  d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
1341  d->defaultToInterpolatorType = true;
1342 }
1343 
1345 {
1346 }
1347 
1363 {
1365  return d->from.value<QVector3D>();
1366 }
1367 
1369 {
1371 }
1372 
1388 {
1390  return d->to.value<QVector3D>();
1391 }
1392 
1394 {
1396 }
1397 
1398 
1399 
1444 {
1445  qreal newt = t;
1446  qreal diff = t-f;
1447  while(diff > 180.0){
1448  newt -= 360.0;
1449  diff -= 360.0;
1450  }
1451  while(diff < -180.0){
1452  newt += 360.0;
1453  diff += 360.0;
1454  }
1455  return QVariant(f + (newt - f) * progress);
1456 }
1457 
1459 {
1460  qreal newt = t;
1461  qreal diff = t-f;
1462  while(diff < 0.0){
1463  newt += 360.0;
1464  diff += 360.0;
1465  }
1466  return QVariant(f + (newt - f) * progress);
1467 }
1468 
1470 {
1471  qreal newt = t;
1472  qreal diff = t-f;
1473  while(diff > 0.0){
1474  newt -= 360.0;
1475  diff -= 360.0;
1476  }
1477  return QVariant(f + (newt - f) * progress);
1478 }
1479 
1482 {
1484  d->interpolatorType = QMetaType::QReal;
1485  d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
1486  d->defaultProperties = QLatin1String("rotation,angle");
1487 }
1488 
1490 {
1491 }
1492 
1523 {
1525  return d->from.toReal();
1526 }
1527 
1529 {
1531 }
1532 
1548 {
1550  return d->to.toReal();
1551 }
1552 
1554 {
1556 }
1557 
1577 {
1579  return d->direction;
1580 }
1581 
1583 {
1585  if (d->direction == direction)
1586  return;
1587 
1588  d->direction = direction;
1589  switch(d->direction) {
1590  case Clockwise:
1591  d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(&_q_interpolateClockwiseRotation);
1592  break;
1593  case Counterclockwise:
1594  d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(&_q_interpolateCounterclockwiseRotation);
1595  break;
1596  case Shortest:
1597  d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(&_q_interpolateShortestRotation);
1598  break;
1599  default:
1600  d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
1601  break;
1602  }
1603 
1605 }
1606 
1607 
1608 
1611 {
1612 }
1613 
1615  : QDeclarativeAbstractAnimation(dd, parent)
1616 {
1617 }
1618 
1620 {
1622  if (q) {
1623  a->setGroup(q);
1624  // This is an optimization for the parenting that already occurs via addAnimation
1625  QDeclarative_setParent_noEvent(a->qtAnimation(), q->d_func()->ag);
1626  q->d_func()->ag->addAnimation(a->qtAnimation());
1627  }
1628 }
1629 
1631 {
1633  if (q) {
1634  while (q->d_func()->animations.count()) {
1635  QDeclarativeAbstractAnimation *firstAnim = q->d_func()->animations.at(0);
1637  q->d_func()->ag->removeAnimation(firstAnim->qtAnimation());
1638  firstAnim->setGroup(0);
1639  }
1640  }
1641 }
1642 
1644 {
1645 }
1646 
1648 {
1653  return list;
1654 }
1655 
1694 {
1696  d->ag = new QSequentialAnimationGroup;
1697  QDeclarative_setParent_noEvent(d->ag, this);
1698 }
1699 
1701 {
1702 }
1703 
1705 {
1707  return d->ag;
1708 }
1709 
1711  QDeclarativeProperties &modified,
1713 {
1715 
1716  int inc = 1;
1717  int from = 0;
1718  if (direction == Backward) {
1719  inc = -1;
1720  from = d->animations.count() - 1;
1721  }
1722 
1723  bool valid = d->defaultProperty.isValid();
1724  for (int ii = from; ii < d->animations.count() && ii >= 0; ii += inc) {
1725  if (valid)
1726  d->animations.at(ii)->setDefaultTarget(d->defaultProperty);
1727  d->animations.at(ii)->transition(actions, modified, direction);
1728  }
1729 }
1730 
1731 
1732 
1766 {
1768  d->ag = new QParallelAnimationGroup;
1769  QDeclarative_setParent_noEvent(d->ag, this);
1770 }
1771 
1773 {
1774 }
1775 
1777 {
1779  return d->ag;
1780 }
1781 
1783  QDeclarativeProperties &modified,
1785 {
1787  bool valid = d->defaultProperty.isValid();
1788  for (int ii = 0; ii < d->animations.count(); ++ii) {
1789  if (valid)
1790  d->animations.at(ii)->setDefaultTarget(d->defaultProperty);
1791  d->animations.at(ii)->transition(actions, modified, direction);
1792  }
1793 }
1794 
1795 
1796 
1797 //convert a variant from string type to another animatable type
1799 {
1800  if (variant.userType() != QVariant::String) {
1801  variant.convert((QVariant::Type)type);
1802  return;
1803  }
1804 
1805  switch (type) {
1806  case QVariant::Rect: {
1808  break;
1809  }
1810  case QVariant::RectF: {
1812  break;
1813  }
1814  case QVariant::Point: {
1816  break;
1817  }
1818  case QVariant::PointF: {
1820  break;
1821  }
1822  case QVariant::Size: {
1824  break;
1825  }
1826  case QVariant::SizeF: {
1828  break;
1829  }
1830  case QVariant::Color: {
1832  break;
1833  }
1834  case QVariant::Vector3D: {
1836  break;
1837  }
1838  default:
1840  variant.convert((QVariant::Type)type);
1841  } else {
1843  if (converter)
1844  variant = converter(variant.toString());
1845  }
1846  break;
1847  }
1848 }
1849 
1917 {
1919  d->init();
1920 }
1921 
1923 : QDeclarativeAbstractAnimation(dd, parent)
1924 {
1926  d->init();
1927 }
1928 
1930 {
1931 }
1932 
1934 {
1938 }
1939 
1950 {
1952  return d->va->duration();
1953 }
1954 
1956 {
1957  if (duration < 0) {
1958  qmlInfo(this) << tr("Cannot set a duration of < 0");
1959  return;
1960  }
1961 
1963  if (d->va->duration() == duration)
1964  return;
1965  d->va->setDuration(duration);
1966  emit durationChanged(duration);
1967 }
1968 
1984 {
1986  return d->from;
1987 }
1988 
1990 {
1992  if (d->fromIsDefined && f == d->from)
1993  return;
1994  d->from = f;
1995  d->fromIsDefined = f.isValid();
1996  emit fromChanged(f);
1997 }
1998 
2014 {
2016  return d->to;
2017 }
2018 
2020 {
2022  if (d->toIsDefined && t == d->to)
2023  return;
2024  d->to = t;
2025  d->toIsDefined = t.isValid();
2026  emit toChanged(t);
2027 }
2028 
2232 {
2234  return d->va->easingCurve();
2235 }
2236 
2238 {
2240  if (d->va->easingCurve() == e)
2241  return;
2242 
2243  d->va->setEasingCurve(e);
2244  emit easingChanged(e);
2245 }
2246 
2248 {
2250  return d->target;
2251 }
2252 
2254 {
2256  if (d->target == o)
2257  return;
2258  d->target = o;
2259  emit targetChanged();
2260 }
2261 
2263 {
2265  return d->propertyName;
2266 }
2267 
2269 {
2271  if (d->propertyName == n)
2272  return;
2273  d->propertyName = n;
2275 }
2276 
2278 {
2280  return d->properties;
2281 }
2282 
2284 {
2286  if (d->properties == prop)
2287  return;
2288 
2289  d->properties = prop;
2290  emit propertiesChanged(prop);
2291 }
2292 
2387 {
2389  return QDeclarativeListProperty<QObject>(this, d->targets);
2390 }
2391 
2401 {
2403  return QDeclarativeListProperty<QObject>(this, d->exclude);
2404 }
2405 
2407 {
2409  return d->va;
2410 }
2411 
2413 {
2414  bool deleted = false;
2415  wasDeleted = &deleted;
2416  if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1
2417  v = 1 - v;
2418  for (int ii = 0; ii < actions.count(); ++ii) {
2419  QDeclarativeAction &action = actions[ii];
2420 
2421  if (v == 1.)
2423  else {
2424  if (!fromSourced && !fromDefined) {
2425  action.fromValue = action.property.read();
2426  if (interpolatorType)
2428  }
2429  if (!interpolatorType) {
2430  int propType = action.property.propertyType();
2431  if (!prevInterpolatorType || prevInterpolatorType != propType) {
2432  prevInterpolatorType = propType;
2433  interpolator = QVariantAnimationPrivate::getInterpolator(prevInterpolatorType);
2434  }
2435  }
2436  if (interpolator)
2438  }
2439  if (deleted)
2440  return;
2441  }
2442  wasDeleted = 0;
2443  fromSourced = true;
2444 }
2445 
2447  QDeclarativeProperties &modified,
2449 {
2451 
2452  QStringList props = d->properties.isEmpty() ? QStringList() : d->properties.split(QLatin1Char(','));
2453  for (int ii = 0; ii < props.count(); ++ii)
2454  props[ii] = props.at(ii).trimmed();
2455  if (!d->propertyName.isEmpty())
2456  props << d->propertyName;
2457 
2458  QList<QObject*> targets = d->targets;
2459  if (d->target)
2460  targets.append(d->target);
2461 
2462  bool hasSelectors = !props.isEmpty() || !targets.isEmpty() || !d->exclude.isEmpty();
2463  bool useType = (props.isEmpty() && d->defaultToInterpolatorType) ? true : false;
2464 
2465  if (d->defaultProperty.isValid() && !hasSelectors) {
2466  props << d->defaultProperty.name();
2467  targets << d->defaultProperty.object();
2468  }
2469 
2470  if (props.isEmpty() && !d->defaultProperties.isEmpty()) {
2471  props << d->defaultProperties.split(QLatin1Char(','));
2472  }
2473 
2475  data->interpolatorType = d->interpolatorType;
2476  data->interpolator = d->interpolator;
2477  data->reverse = direction == Backward ? true : false;
2478  data->fromSourced = false;
2479  data->fromDefined = d->fromIsDefined;
2480 
2481  bool hasExplicit = false;
2482  //an explicit animation has been specified
2483  if (d->toIsDefined) {
2484  for (int i = 0; i < props.count(); ++i) {
2485  for (int j = 0; j < targets.count(); ++j) {
2486  QDeclarativeAction myAction;
2487  myAction.property = d->createProperty(targets.at(j), props.at(i), this);
2488  if (myAction.property.isValid()) {
2489  if (d->fromIsDefined) {
2490  myAction.fromValue = d->from;
2491  d->convertVariant(myAction.fromValue, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType());
2492  }
2493  myAction.toValue = d->to;
2494  d->convertVariant(myAction.toValue, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType());
2495  data->actions << myAction;
2496  hasExplicit = true;
2497  for (int ii = 0; ii < actions.count(); ++ii) {
2498  QDeclarativeAction &action = actions[ii];
2499  if (action.property.object() == myAction.property.object() &&
2500  myAction.property.name() == action.property.name()) {
2501  modified << action.property;
2502  break; //### any chance there could be multiples?
2503  }
2504  }
2505  }
2506  }
2507  }
2508  }
2509 
2510  if (!hasExplicit)
2511  for (int ii = 0; ii < actions.count(); ++ii) {
2512  QDeclarativeAction &action = actions[ii];
2513 
2514  QObject *obj = action.property.object();
2515  QString propertyName = action.property.name();
2516  QObject *sObj = action.specifiedObject;
2517  QString sPropertyName = action.specifiedProperty;
2518  bool same = (obj == sObj);
2519 
2520  if ((targets.isEmpty() || targets.contains(obj) || (!same && targets.contains(sObj))) &&
2521  (!d->exclude.contains(obj)) && (same || (!d->exclude.contains(sObj))) &&
2522  (props.contains(propertyName) || (!same && props.contains(sPropertyName))
2523  || (useType && action.property.propertyType() == d->interpolatorType))) {
2524  QDeclarativeAction myAction = action;
2525 
2526  if (d->fromIsDefined)
2527  myAction.fromValue = d->from;
2528  else
2529  myAction.fromValue = QVariant();
2530  if (d->toIsDefined)
2531  myAction.toValue = d->to;
2532 
2533  d->convertVariant(myAction.fromValue, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType());
2534  d->convertVariant(myAction.toValue, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType());
2535 
2536  modified << action.property;
2537 
2538  data->actions << myAction;
2539  action.fromValue = myAction.toValue;
2540  }
2541  }
2542 
2543  if (data->actions.count()) {
2544  if (!d->rangeIsSet) {
2545  d->va->setStartValue(qreal(0));
2546  d->va->setEndValue(qreal(1));
2547  d->rangeIsSet = true;
2548  }
2549  d->va->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped);
2550  d->va->setFromSourcedValue(&data->fromSourced);
2551  d->actions = &data->actions;
2552  } else {
2553  delete data;
2554  d->va->setFromSourcedValue(0); //clear previous data
2555  d->va->setAnimValue(0, QAbstractAnimation::DeleteWhenStopped); //clear previous data
2556  d->actions = 0;
2557  }
2558 }
2559 
2602 {
2604  d->topLevelGroup = new QSequentialAnimationGroup;
2605  QDeclarative_setParent_noEvent(d->topLevelGroup, this);
2606 
2607  d->startAction = new QActionAnimation;
2608  QDeclarative_setParent_noEvent(d->startAction, d->topLevelGroup);
2609  d->topLevelGroup->addAnimation(d->startAction);
2610 
2611  d->ag = new QParallelAnimationGroup;
2612  QDeclarative_setParent_noEvent(d->ag, d->topLevelGroup);
2613  d->topLevelGroup->addAnimation(d->ag);
2614 
2615  d->endAction = new QActionAnimation;
2616  QDeclarative_setParent_noEvent(d->endAction, d->topLevelGroup);
2617  d->topLevelGroup->addAnimation(d->endAction);
2618 }
2619 
2621 {
2622 }
2623 
2635 {
2637  return d->target;
2638 }
2639 
2641 {
2643  if (target == d->target)
2644  return;
2645 
2646  d->target = target;
2647  emit targetChanged();
2648 }
2649 
2663 {
2665  return d->newParent;
2666 }
2667 
2669 {
2671  if (newParent == d->newParent)
2672  return;
2673 
2674  d->newParent = newParent;
2676 }
2677 
2695 {
2697  return d->via;
2698 }
2699 
2701 {
2703  if (via == d->via)
2704  return;
2705 
2706  d->via = via;
2707  emit viaChanged();
2708 }
2709 
2710 //### mirrors same-named function in QDeclarativeItem
2712 {
2713  switch(origin) {
2714  default:
2716  return QPointF(0, 0);
2717  case QDeclarativeItem::Top:
2718  return QPointF(width / 2., 0);
2720  return QPointF(width, 0);
2722  return QPointF(0, height / 2.);
2724  return QPointF(width / 2., height / 2.);
2726  return QPointF(width, height / 2.);
2728  return QPointF(0, height);
2730  return QPointF(width / 2., height);
2732  return QPointF(width, height);
2733  }
2734 }
2735 
2737  QDeclarativeProperties &modified,
2739 {
2741 
2742  struct QDeclarativeParentAnimationData : public QAbstractAnimationAction
2743  {
2744  QDeclarativeParentAnimationData() {}
2745  ~QDeclarativeParentAnimationData() { qDeleteAll(pc); }
2746 
2747  QDeclarativeStateActions actions;
2748  //### reverse should probably apply on a per-action basis
2749  bool reverse;
2751  virtual void doAction()
2752  {
2753  for (int ii = 0; ii < actions.count(); ++ii) {
2754  const QDeclarativeAction &action = actions.at(ii);
2755  if (reverse)
2756  action.event->reverse();
2757  else
2758  action.event->execute();
2759  }
2760  }
2761  };
2762 
2763  QDeclarativeParentAnimationData *data = new QDeclarativeParentAnimationData;
2764  QDeclarativeParentAnimationData *viaData = new QDeclarativeParentAnimationData;
2765 
2766  bool hasExplicit = false;
2767  if (d->target && d->newParent) {
2768  data->reverse = false;
2769  QDeclarativeAction myAction;
2771  pc->setObject(d->target);
2772  pc->setParent(d->newParent);
2773  myAction.event = pc;
2774  data->pc << pc;
2775  data->actions << myAction;
2776  hasExplicit = true;
2777  if (d->via) {
2778  viaData->reverse = false;
2779  QDeclarativeAction myVAction;
2781  vpc->setObject(d->target);
2782  vpc->setParent(d->via);
2783  myVAction.event = vpc;
2784  viaData->pc << vpc;
2785  viaData->actions << myVAction;
2786  }
2787  //### once actions have concept of modified,
2788  // loop to match appropriate ParentChanges and mark as modified
2789  }
2790 
2791  if (!hasExplicit)
2792  for (int i = 0; i < actions.size(); ++i) {
2793  QDeclarativeAction &action = actions[i];
2794  if (action.event && action.event->typeName() == QLatin1String("ParentChange")
2795  && (!d->target || static_cast<QDeclarativeParentChange*>(action.event)->object() == d->target)) {
2796 
2797  QDeclarativeParentChange *pc = static_cast<QDeclarativeParentChange*>(action.event);
2798  QDeclarativeAction myAction = action;
2799  data->reverse = action.reverseEvent;
2800 
2801  //### this logic differs from PropertyAnimation
2802  // (probably a result of modified vs. done)
2803  if (d->newParent) {
2805  epc->setObject(static_cast<QDeclarativeParentChange*>(action.event)->object());
2806  epc->setParent(d->newParent);
2807  myAction.event = epc;
2808  data->pc << epc;
2809  data->actions << myAction;
2810  pc = epc;
2811  } else {
2812  action.actionDone = true;
2813  data->actions << myAction;
2814  }
2815 
2816  if (d->via) {
2817  viaData->reverse = false;
2818  QDeclarativeAction myAction;
2820  vpc->setObject(pc->object());
2821  vpc->setParent(d->via);
2822  myAction.event = vpc;
2823  viaData->pc << vpc;
2824  viaData->actions << myAction;
2825  QDeclarativeAction dummyAction;
2826  QDeclarativeAction &xAction = pc->xIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
2827  QDeclarativeAction &yAction = pc->yIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
2828  QDeclarativeAction &sAction = pc->scaleIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
2829  QDeclarativeAction &rAction = pc->rotationIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
2830  QDeclarativeItem *target = pc->object();
2831  QDeclarativeItem *targetParent = action.reverseEvent ? pc->originalParent() : pc->parent();
2832 
2833  //### this mirrors the logic in QDeclarativeParentChange.
2834  bool ok;
2835  const QTransform &transform = targetParent->itemTransform(d->via, &ok);
2836  if (transform.type() >= QTransform::TxShear || !ok) {
2837  qmlInfo(this) << QDeclarativeParentAnimation::tr("Unable to preserve appearance under complex transform");
2838  ok = false;
2839  }
2840 
2841  qreal scale = 1;
2842  qreal rotation = 0;
2843  bool isRotate = (transform.type() == QTransform::TxRotate) || (transform.m11() < 0);
2844  if (ok && !isRotate) {
2845  if (transform.m11() == transform.m22())
2846  scale = transform.m11();
2847  else {
2848  qmlInfo(this) << QDeclarativeParentAnimation::tr("Unable to preserve appearance under non-uniform scale");
2849  ok = false;
2850  }
2851  } else if (ok && isRotate) {
2852  if (transform.m11() == transform.m22())
2853  scale = qSqrt(transform.m11()*transform.m11() + transform.m12()*transform.m12());
2854  else {
2855  qmlInfo(this) << QDeclarativeParentAnimation::tr("Unable to preserve appearance under non-uniform scale");
2856  ok = false;
2857  }
2858 
2859  if (scale != 0)
2860  rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/qreal(M_PI);
2861  else {
2862  qmlInfo(this) << QDeclarativeParentAnimation::tr("Unable to preserve appearance under scale of 0");
2863  ok = false;
2864  }
2865  }
2866 
2867  const QPointF &point = transform.map(QPointF(xAction.toValue.toReal(),yAction.toValue.toReal()));
2868  qreal x = point.x();
2869  qreal y = point.y();
2870  if (ok && target->transformOrigin() != QDeclarativeItem::TopLeft) {
2871  qreal w = target->width();
2872  qreal h = target->height();
2873  if (pc->widthIsSet() && i < actions.size() - 1)
2874  w = actions[++i].toValue.toReal();
2875  if (pc->heightIsSet() && i < actions.size() - 1)
2876  h = actions[++i].toValue.toReal();
2877  const QPointF &transformOrigin
2878  = d->computeTransformOrigin(target->transformOrigin(), w,h);
2879  qreal tempxt = transformOrigin.x();
2880  qreal tempyt = transformOrigin.y();
2881  QTransform t;
2882  t.translate(-tempxt, -tempyt);
2883  t.rotate(rotation);
2884  t.scale(scale, scale);
2885  t.translate(tempxt, tempyt);
2886  const QPointF &offset = t.map(QPointF(0,0));
2887  x += offset.x();
2888  y += offset.y();
2889  }
2890 
2891  if (ok) {
2892  //qDebug() << x << y << rotation << scale;
2893  xAction.toValue = x;
2894  yAction.toValue = y;
2895  sAction.toValue = sAction.toValue.toReal() * scale;
2896  rAction.toValue = rAction.toValue.toReal() + rotation;
2897  }
2898  }
2899  }
2900  }
2901 
2902  if (data->actions.count()) {
2903  if (direction == QDeclarativeAbstractAnimation::Forward) {
2904  d->startAction->setAnimAction(d->via ? viaData : data, QActionAnimation::DeleteWhenStopped);
2905  d->endAction->setAnimAction(d->via ? data : 0, QActionAnimation::DeleteWhenStopped);
2906  } else {
2907  d->endAction->setAnimAction(d->via ? viaData : data, QActionAnimation::DeleteWhenStopped);
2908  d->startAction->setAnimAction(d->via ? data : 0, QActionAnimation::DeleteWhenStopped);
2909  }
2910  if (!d->via)
2911  delete viaData;
2912  } else {
2913  delete data;
2914  delete viaData;
2915  }
2916 
2917  //take care of any child animations
2918  bool valid = d->defaultProperty.isValid();
2919  for (int ii = 0; ii < d->animations.count(); ++ii) {
2920  if (valid)
2921  d->animations.at(ii)->setDefaultTarget(d->defaultProperty);
2922  d->animations.at(ii)->transition(actions, modified, direction);
2923  }
2924 
2925 }
2926 
2928 {
2930  return d->topLevelGroup;
2931 }
2932 
2964 {
2966  d->va = new QDeclarativeBulkValueAnimator;
2967  QDeclarative_setParent_noEvent(d->va, this);
2968 }
2969 
2971 {
2972 }
2973 
2975 {
2977  return d->va;
2978 }
2979 
2991 {
2993  return QDeclarativeListProperty<QDeclarativeItem>(this, d->targets);
2994 }
2995 
3006 {
3008  return d->va->duration();
3009 }
3010 
3012 {
3013  if (duration < 0) {
3014  qmlInfo(this) << tr("Cannot set a duration of < 0");
3015  return;
3016  }
3017 
3019  if (d->va->duration() == duration)
3020  return;
3021  d->va->setDuration(duration);
3022  emit durationChanged(duration);
3023 }
3024 
3048 {
3050  return d->va->easingCurve();
3051 }
3052 
3054 {
3056  if (d->va->easingCurve() == e)
3057  return;
3058 
3059  d->va->setEasingCurve(e);
3060  emit easingChanged(e);
3061 }
3062 
3064  QDeclarativeProperties &modified,
3066 {
3067  Q_UNUSED(modified);
3071  data->interpolator = d->interpolator;
3072 
3073  data->reverse = direction == Backward ? true : false;
3074  data->fromSourced = false;
3075  data->fromDefined = false;
3076 
3077  for (int ii = 0; ii < actions.count(); ++ii) {
3078  QDeclarativeAction &action = actions[ii];
3079  if (action.event && action.event->typeName() == QLatin1String("AnchorChanges")
3080  && (d->targets.isEmpty() || d->targets.contains(static_cast<QDeclarativeAnchorChanges*>(action.event)->object()))) {
3081  data->actions << static_cast<QDeclarativeAnchorChanges*>(action.event)->additionalActions();
3082  }
3083  }
3084 
3085  if (data->actions.count()) {
3086  if (!d->rangeIsSet) {
3087  d->va->setStartValue(qreal(0));
3088  d->va->setEndValue(qreal(1));
3089  d->rangeIsSet = true;
3090  }
3091  d->va->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped);
3092  d->va->setFromSourcedValue(&data->fromSourced);
3093  } else {
3094  delete data;
3095  }
3096 }
3097 
3099  : QDeclarativeAbstractAnimationPrivate(), hasRunScriptScript(false), reversing(false), proxy(this), rsa(0) {}
3100 
3101 
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
The QVector3D class represents a vector or vertex in 3D space.
Definition: qvector3d.h:60
static QDeclarativeData * get(const QObject *object, bool create=false)
QColor Q_DECLARATIVE_PRIVATE_EXPORT colorFromString(const QString &, bool *ok=0)
int type
Definition: qmetatype.cpp:239
QDeclarativeProperty property
double qreal
Definition: qglobal.h:1193
QDeclarativeParallelAnimation(QObject *parent=0)
QDeclarativeContext * context() const
Returns the context for the script.
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void setLoopCount(int loopCount)
QDeclarativeParserStatus ** d
void easingChanged(const QEasingCurve &)
The QEasingCurve class provides easing curves for controlling animation.
Definition: qeasingcurve.h:55
void setGroup(QDeclarativeAnimationGroup *)
QDeclarativeListProperty< QObject > exclude()
QTransform itemTransform(const QGraphicsItem *other, bool *ok=0) const
Returns a QTransform that maps coordinates from this item to other.
QDeclarativeAbstractAnimation(QObject *parent=0)
The QSequentialAnimationGroup class provides a sequential group of animations.
virtual void transition(QDeclarativeStateActions &actions, QDeclarativeProperties &modified, TransitionDirection direction)
static C reverse(const C &l)
#define SLOT(a)
Definition: qobjectdefs.h:226
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
QVector3D Q_DECLARATIVE_PRIVATE_EXPORT vector3DFromString(const QString &, bool *ok=0)
virtual void transition(QDeclarativeStateActions &actions, QDeclarativeProperties &modified, TransitionDirection direction)
The QPauseAnimation class provides a pause for QSequentialAnimationGroup.
qreal m22() const
Returns the vertical scaling factor.
Definition: qtransform.h:253
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
Definition: qvariant.cpp:2270
void easingChanged(const QEasingCurve &)
void setScript(const QDeclarativeScriptString &)
TransformOrigin transformOrigin
Returns the current transform origin.
QVariant _q_interpolateClockwiseRotation(qreal &f, qreal &t, qreal progress)
virtual void transition(QDeclarativeStateActions &actions, QDeclarativeProperties &modified, TransitionDirection direction)
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QEasingCurve easing() const
long ASN1_INTEGER_get ASN1_INTEGER * a
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
QTransform & translate(qreal dx, qreal dy)
Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to t...
Definition: qtransform.cpp:417
static Q_CORE_EXPORT QVariantAnimation::Interpolator getInterpolator(int interpolationType)
The QString class provides a Unicode character string.
Definition: qstring.h:83
void resume()
Resumes the animation after it was paused.
T * qobject_cast(QObject *object)
Definition: qobject.h:375
QString properties() const
virtual QAbstractAnimation * qtAnimation()
void setValue(const T &value)
Stores a copy of value.
Definition: qvariant.h:527
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
TransformationType type() const
Returns the transformation type of this matrix.
Q_DECLARATIVE_EXPORT QDeclarativeContext * qmlContext(const QObject *)
void setNewParent(QDeclarativeItem *)
#define Q_D(Class)
Definition: qglobal.h:2482
bool isValid() const
Returns true if the QDeclarativeProperty refers to a valid property, otherwise false.
static QDeclarativeEnginePrivate * get(QDeclarativeEngine *e)
virtual void transition(QDeclarativeStateActions &actions, QDeclarativeProperties &modified, TransitionDirection direction)
#define M_PI
Definition: qmath.h:261
virtual void setTarget(const QDeclarativeProperty &)
Set the target property for the value source.
QDeclarativeItem * via() const
QVariant(* Interpolator)(const void *from, const void *to, qreal progress)
void stop()
Stops the animation.
QRectF Q_DECLARATIVE_PRIVATE_EXPORT rectFFromString(const QString &, bool *ok=0)
void classBegin()
Invoked after class creation, but before any properties have been set.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
void setParent(QObject *)
Makes the object a child of parent.
Definition: qobject.cpp:1950
#define Q_Q(Class)
Definition: qglobal.h:2483
QDeclarativeListProperty< QObject > targets()
virtual void componentComplete()=0
Invoked after the root component that caused this instantiation has completed construction.
QDeclarativeAnchorAnimation(QObject *parent=0)
#define SIGNAL(a)
Definition: qobjectdefs.h:227
qreal m12() const
Returns the vertical shearing factor.
Definition: qtransform.h:241
QObject * object() const
Returns the QDeclarativeProperty&#39;s QObject.
virtual QAbstractAnimation * qtAnimation()
int currentLoopTime() const
Returns the current time inside the current loop.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
virtual QAbstractAnimation * qtAnimation()
QDeclarativeParentAnimation(QObject *parent=0)
void propertiesChanged(const QString &)
The QDeclarativeScriptString class encapsulates a script and its context.
QEasingCurve easing() const
QDeclarativeItem * object() const
QVariant _q_interpolateShortestRotation(qreal &f, qreal &t, qreal progress)
QPointF Q_DECLARATIVE_PRIVATE_EXPORT pointFFromString(const QString &, bool *ok=0)
The QDeclarativeItem class provides the most basic of all visual items in QML.
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
Definition: qstring.cpp:4506
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
void setEasing(const QEasingCurve &)
QDeclarativePauseAnimation(QObject *parent=0)
const char * name
QTransform & rotate(qreal a, Qt::Axis axis=Qt::ZAxis)
Rotates the coordinate system counterclockwise by the given angle about the specified axis and return...
Definition: qtransform.cpp:615
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define emit
Definition: qobjectdefs.h:76
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
QVariant _q_interpolateCounterclockwiseRotation(qreal &f, qreal &t, qreal progress)
QPoint map(const QPoint &p) const
Creates and returns a QPoint object that is a copy of the given point, mapped into the coordinate sys...
static const char * data(const QByteArray &arr)
unsigned int uint
Definition: qglobal.h:996
void setTarget(QDeclarativeItem *)
static Bigint * diff(Bigint *a, Bigint *b)
virtual void execute(Reason reason=ActualChange)
Type
This enum type defines the types of variable that a QVariant can contain.
Definition: qvariant.h:95
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
Definition: qstringlist.h:172
virtual QAbstractAnimation * qtAnimation()
RotationDirection direction() const
void setDirection(RotationDirection direction)
void registerFinalizedParserStatusObject(QObject *obj, int index)
The QAbstractAnimation class is the base of all animations.
void valueChanged(const QVariant &)
QDeclarativePropertyAction(QObject *parent=0)
QObject * target() const
virtual QString typeName() const
QDeclarativeListProperty< QObject > targets()
virtual void transition(QDeclarativeStateActions &actions, QDeclarativeProperties &modified, TransitionDirection direction)
bool convert(Type t)
Casts the variant to the requested type, t.
Definition: qvariant.cpp:2959
void setDefaultTarget(const QDeclarativeProperty &)
QPointF computeTransformOrigin(QDeclarativeItem::TransformOrigin origin, qreal width, qreal height) const
static void append_animation(QDeclarativeListProperty< QDeclarativeAbstractAnimation > *list, QDeclarativeAbstractAnimation *role)
QDeclarativePropertyAnimation(QObject *parent=0)
QVariantAnimation::Interpolator interpolator
void componentComplete()
Invoked after the root component that caused this instantiation has completed construction.
static QDeclarativeProperty createProperty(QObject *obj, const QString &str, QObject *infoObj)
QDeclarativeItem * newParent() const
virtual QAbstractAnimation * qtAnimation()
QSizeF Q_DECLARATIVE_PRIVATE_EXPORT sizeFFromString(const QString &, bool *ok=0)
TransformOrigin
Controls the point about which simple transforms like scale apply.
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
int userType() const
Returns the storage type of the value stored in the variant.
Definition: qvariant.cpp:1913
The QParallelAnimationGroup class provides a parallel group of animations.
virtual QAbstractAnimation * qtAnimation()=0
int propertyType() const
Returns the QVariant type of the property, or QVariant::Invalid if the property has no QVariant type...
QDeclarativeRotationAnimation(QObject *parent=0)
QDeclarativeAnimationGroup * group() const
Q_DECLARATIVE_EXPORT QDeclarativeEngine * qmlEngine(const QObject *)
QDeclarativeListProperty< QObject > exclude()
QDeclarativeListProperty< QDeclarativeItem > targets()
QDeclarativeScriptAction(QObject *parent=0)
QDeclarativeItem * target() const
void QDeclarative_setParent_noEvent(QObject *object, QObject *parent)
Makes the object a child of parent.
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
const void * constData() const
Definition: qvariant.cpp:3065
virtual void transition(QDeclarativeStateActions &actions, QDeclarativeProperties &modified, TransitionDirection direction)
QDeclarativeNumberAnimation(QObject *parent=0)
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
void setStateChangeScriptName(const QString &)
if(void) toggleToolbarShown
virtual void transition(QDeclarativeStateActions &actions, QDeclarativeProperties &modified, TransitionDirection direction)
void pause()
Pauses the animation.
static StringConverter customStringConverter(int)
Return the custom string converter for type, previously installed through registerCustomStringConvert...
bool isWritable() const
Returns true if the property is writable, otherwise false.
virtual int duration() const
QObject * scopeObject() const
Returns the scope object for the script.
static const QCssKnownValue properties[NumProperties - 1]
Definition: qcssparser.cpp:67
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
static void clear_animation(QDeclarativeListProperty< QDeclarativeAbstractAnimation > *list)
The QDeclarativeProperty class abstracts accessing properties on objects created from QML...
QTransform & scale(qreal sx, qreal sy)
Scales the coordinate system by sx horizontally and sy vertically, and returns a reference to the mat...
Definition: qtransform.cpp:485
virtual QAbstractAnimation * qtAnimation()
QDeclarativeActionEvent * event
QDeclarativeListProperty< QDeclarativeAbstractAnimation > animations
void propertiesChanged(const QString &)
const char * variant
The QDeclarativeExpression class evaluates JavaScript in a QML context.
QDeclarativeInfo qmlInfo(const QObject *me)
QDeclarativeColorAnimation(QObject *parent=0)
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
Definition: qvariant.h:485
virtual void transition(QDeclarativeStateActions &actions, QDeclarativeProperties &modified, TransitionDirection direction)
QString name() const
Return the name of this QML property.
virtual QAbstractAnimation * qtAnimation()
static void convertVariant(QVariant &variant, int type)
QDeclarativeListProperty< QDeclarativeAbstractAnimation > animations()
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
void setCurrentTime(int msecs)
qreal qSqrt(qreal v)
Definition: qmath.h:205
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
Definition: qalgorithms.h:319
QDeclarativeScriptString script() const
virtual void reverse(Reason reason=ActualChange)
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
QVariant value() const
virtual QAbstractAnimation * qtAnimation()
QDeclarativeVector3dAnimation(QObject *parent=0)
QString script() const
Returns the script text.
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
qreal m11() const
Returns the horizontal scaling factor.
Definition: qtransform.h:237
qreal toReal(bool *ok=0) const
Returns the variant as a qreal if the variant has type() Double , QMetaType::Float ...
Definition: qvariant.cpp:2740
QDeclarativeItem * originalParent() const
QString property() const
QVariant(* StringConverter)(const QString &)
QVariant read() const
Returns the property value.
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65
static bool write(QObject *, const QDeclarativePropertyCache::Data &, const QVariant &, QDeclarativeContextData *, WriteFlags flags=0)
Qt::LayoutDirection direction
void setEasing(const QEasingCurve &)