Qt 4.8
qdeclarativestateoperations.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/qdeclarativestateoperations_p.h"
43 
44 #include <qdeclarative.h>
45 #include <qdeclarativecontext.h>
46 #include <qdeclarativeexpression.h>
47 #include <qdeclarativeinfo.h>
49 #include <qdeclarativeitem_p.h>
50 #include <qdeclarativeguard_p.h>
52 #include "private/qdeclarativecontext_p.h"
53 #include "private/qdeclarativeproperty_p.h"
54 #include "private/qdeclarativebinding_p.h"
55 #include "private/qdeclarativestate_p_p.h"
56 
57 #include <QtCore/qdebug.h>
58 #include <QtGui/qgraphicsitem.h>
59 #ifdef Q_OS_WINCE
60 // qgraphicsitem.h includes qfunctions_wince.h.
61 // qfunctions_wince.h defines a missing posix rewind for WinCE,
62 // but this conflicts with rewind method defined in this class.
63 // As a workaround we undefine WinCE posix replacement for rewind here.
64 # undef rewind
65 #endif
66 #include <QtCore/qmath.h>
67 
68 #include <private/qobject_p.h>
69 
71 
73 {
75 public:
78 
85 
92 
99 
100  void doChange(QDeclarativeItem *targetParent, QDeclarativeItem *stackBefore = 0);
101 };
102 
104 {
105  if (targetParent && target && target->parentItem()) {
107  bool ok;
108  const QTransform &transform = target->parentItem()->itemTransform(targetParent, &ok);
109  if (transform.type() >= QTransform::TxShear || !ok) {
110  qmlInfo(q) << QDeclarativeParentChange::tr("Unable to preserve appearance under complex transform");
111  ok = false;
112  }
113 
114  qreal scale = 1;
115  qreal rotation = 0;
116  bool isRotate = (transform.type() == QTransform::TxRotate) || (transform.m11() < 0);
117  if (ok && !isRotate) {
118  if (transform.m11() == transform.m22())
119  scale = transform.m11();
120  else {
121  qmlInfo(q) << QDeclarativeParentChange::tr("Unable to preserve appearance under non-uniform scale");
122  ok = false;
123  }
124  } else if (ok && isRotate) {
125  if (transform.m11() == transform.m22())
126  scale = qSqrt(transform.m11()*transform.m11() + transform.m12()*transform.m12());
127  else {
128  qmlInfo(q) << QDeclarativeParentChange::tr("Unable to preserve appearance under non-uniform scale");
129  ok = false;
130  }
131 
132  if (scale != 0)
133  rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/qreal(M_PI);
134  else {
135  qmlInfo(q) << QDeclarativeParentChange::tr("Unable to preserve appearance under scale of 0");
136  ok = false;
137  }
138  }
139 
140  const QPointF &point = transform.map(QPointF(target->x(),target->y()));
141  qreal x = point.x();
142  qreal y = point.y();
143 
144  // setParentItem will update the transformOriginPoint if needed
145  target->setParentItem(targetParent);
146 
148  qreal tempxt = target->transformOriginPoint().x();
149  qreal tempyt = target->transformOriginPoint().y();
150  QTransform t;
151  t.translate(-tempxt, -tempyt);
152  t.rotate(rotation);
153  t.scale(scale, scale);
154  t.translate(tempxt, tempyt);
155  const QPointF &offset = t.map(QPointF(0,0));
156  x += offset.x();
157  y += offset.y();
158  }
159 
160  if (ok) {
161  //qDebug() << x << y << rotation << scale;
162  target->setX(x);
163  target->setY(y);
166  }
167  } else if (target) {
168  target->setParentItem(targetParent);
169  }
170 
171  //restore the original stack position.
172  //### if stackBefore has also been reparented this won't work
173  if (stackBefore)
174  target->stackBefore(stackBefore);
175 }
176 
210 {
211 }
212 
214 {
215 }
216 
231 {
233  return d->xString.value;
234 }
235 
237 {
238  bool ok = false;
239  qreal realValue = string.toFloat(&ok);
240  if (ok)
241  value = realValue;
242  else
243  value.invalidate();
244 }
245 
247 {
249  d->xString = x;
250  tryReal(d->x, x.script());
251 }
252 
254 {
256  return d->xString.isValid();
257 }
258 
260 {
262  return d->yString.value;
263 }
264 
266 {
268  d->yString = y;
269  tryReal(d->y, y.script());
270 }
271 
273 {
275  return d->yString.isValid();
276 }
277 
279 {
281  return d->widthString.value;
282 }
283 
285 {
287  d->widthString = width;
288  tryReal(d->width, width.script());
289 }
290 
292 {
294  return d->widthString.isValid();
295 }
296 
298 {
300  return d->heightString.value;
301 }
302 
304 {
306  d->heightString = height;
307  tryReal(d->height, height.script());
308 }
309 
311 {
313  return d->heightString.isValid();
314 }
315 
317 {
319  return d->scaleString.value;
320 }
321 
323 {
325  d->scaleString = scale;
326  tryReal(d->scale, scale.script());
327 }
328 
330 {
332  return d->scaleString.isValid();
333 }
334 
336 {
338  return d->rotationString.value;
339 }
340 
342 {
344  d->rotationString = rotation;
345  tryReal(d->rotation, rotation.script());
346 }
347 
349 {
351  return d->rotationString.isValid();
352 }
353 
355 {
357  return d->origParent;
358 }
359 
366 {
368  return d->target;
369 }
370 
372 {
374  d->target = target;
375 }
376 
386 {
388  return d->parent;
389 }
390 
392 {
394  d->parent = parent;
395 }
396 
398 {
400  if (!d->target || !d->parent)
401  return ActionList();
402 
404 
406  a.event = this;
407  actions << a;
408 
409  QDeclarativeContext *ctxt = qmlContext(this);
410 
411  if (d->xString.isValid()) {
412  if (d->x.isValid()) {
413  QDeclarativeAction xa(d->target, QLatin1String("x"), ctxt, d->x.value);
414  actions << xa;
415  } else {
416  QDeclarativeBinding *newBinding = new QDeclarativeBinding(d->xString.value.script(), d->target, ctxt);
417  newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("x"), ctxt));
419  xa.property = newBinding->property();
420  xa.toBinding = newBinding;
421  xa.fromValue = xa.property.read();
422  xa.deletableToBinding = true;
423  actions << xa;
424  }
425  }
426 
427  if (d->yString.isValid()) {
428  if (d->y.isValid()) {
429  QDeclarativeAction ya(d->target, QLatin1String("y"), ctxt, d->y.value);
430  actions << ya;
431  } else {
432  QDeclarativeBinding *newBinding = new QDeclarativeBinding(d->yString.value.script(), d->target, ctxt);
433  newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("y"), ctxt));
435  ya.property = newBinding->property();
436  ya.toBinding = newBinding;
437  ya.fromValue = ya.property.read();
438  ya.deletableToBinding = true;
439  actions << ya;
440  }
441  }
442 
443  if (d->scaleString.isValid()) {
444  if (d->scale.isValid()) {
445  QDeclarativeAction sa(d->target, QLatin1String("scale"), ctxt, d->scale.value);
446  actions << sa;
447  } else {
448  QDeclarativeBinding *newBinding = new QDeclarativeBinding(d->scaleString.value.script(), d->target, ctxt);
449  newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("scale"), ctxt));
451  sa.property = newBinding->property();
452  sa.toBinding = newBinding;
453  sa.fromValue = sa.property.read();
454  sa.deletableToBinding = true;
455  actions << sa;
456  }
457  }
458 
459  if (d->rotationString.isValid()) {
460  if (d->rotation.isValid()) {
461  QDeclarativeAction ra(d->target, QLatin1String("rotation"), ctxt, d->rotation.value);
462  actions << ra;
463  } else {
464  QDeclarativeBinding *newBinding = new QDeclarativeBinding(d->rotationString.value.script(), d->target, ctxt);
465  newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("rotation"), ctxt));
467  ra.property = newBinding->property();
468  ra.toBinding = newBinding;
469  ra.fromValue = ra.property.read();
470  ra.deletableToBinding = true;
471  actions << ra;
472  }
473  }
474 
475  if (d->widthString.isValid()) {
476  if (d->width.isValid()) {
477  QDeclarativeAction wa(d->target, QLatin1String("width"), ctxt, d->width.value);
478  actions << wa;
479  } else {
480  QDeclarativeBinding *newBinding = new QDeclarativeBinding(d->widthString.value.script(), d->target, ctxt);
481  newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("width"), ctxt));
483  wa.property = newBinding->property();
484  wa.toBinding = newBinding;
485  wa.fromValue = wa.property.read();
486  wa.deletableToBinding = true;
487  actions << wa;
488  }
489  }
490 
491  if (d->heightString.isValid()) {
492  if (d->height.isValid()) {
493  QDeclarativeAction ha(d->target, QLatin1String("height"), ctxt, d->height.value);
494  actions << ha;
495  } else {
496  QDeclarativeBinding *newBinding = new QDeclarativeBinding(d->heightString.value.script(), d->target, ctxt);
497  newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("height"), ctxt));
499  ha.property = newBinding->property();
500  ha.toBinding = newBinding;
501  ha.fromValue = ha.property.read();
502  ha.deletableToBinding = true;
503  actions << ha;
504  }
505  }
506 
507  return actions;
508 }
509 
511 {
512  Q_OBJECT
514 public:
515  int siblingIndex() {
517  return d->siblingIndex;
518  }
519 };
520 
522 {
525  d->origParent = d->rewindParent;
526  d->origStackBefore = d->rewindStackBefore;
527 }
528 
529 /*void QDeclarativeParentChange::copyOriginals(QDeclarativeActionEvent *other)
530 {
531  Q_D(QDeclarativeParentChange);
532  QDeclarativeParentChange *pc = static_cast<QDeclarativeParentChange*>(other);
533 
534  d->origParent = pc->d_func()->rewindParent;
535  d->origStackBefore = pc->d_func()->rewindStackBefore;
536 
537  saveCurrentValues();
538 }*/
539 
541 {
543  d->doChange(d->parent);
544 }
545 
547 {
548  return true;
549 }
550 
552 {
554  d->doChange(d->origParent, d->origStackBefore);
555 }
556 
558 {
559  return QLatin1String("ParentChange");
560 }
561 
563 {
565  if (other->typeName() != QLatin1String("ParentChange"))
566  return false;
567  if (QDeclarativeParentChange *otherPC = static_cast<QDeclarativeParentChange*>(other))
568  return (d->target == otherPC->object());
569  return false;
570 }
571 
573 {
575  if (!d->target) {
576  d->rewindParent = 0;
577  d->rewindStackBefore = 0;
578  return;
579  }
580 
581  d->rewindParent = d->target->parentItem();
582  d->rewindStackBefore = 0;
583 
584  if (!d->rewindParent)
585  return;
586 
587  //try to determine the item's original stack position so we can restore it
588  int siblingIndex = ((AccessibleFxItem*)d->target)->siblingIndex() + 1;
589  QList<QGraphicsItem*> children = d->rewindParent->childItems();
590  for (int i = 0; i < children.count(); ++i) {
591  QDeclarativeItem *child = qobject_cast<QDeclarativeItem*>(children.at(i));
592  if (!child)
593  continue;
594  if (((AccessibleFxItem*)child)->siblingIndex() == siblingIndex) {
595  d->rewindStackBefore = child;
596  break;
597  }
598  }
599 }
600 
602 {
604  d->doChange(d->rewindParent, d->rewindStackBefore);
605 }
606 
608 {
609 public:
611 
614 };
615 
635 {
636 }
637 
639 {
640 }
641 
650 {
652  return d->script;
653 }
654 
656 {
658  d->script = s;
659 }
660 
672 {
674  return d->name;
675 }
676 
678 {
680  d->name = n;
681 }
682 
684 {
686  const QString &script = d->script.script();
687  if (!script.isEmpty()) {
688  QDeclarativeExpression expr(d->script.context(), d->script.scopeObject(), script);
690  if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
691  expr.setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
692  expr.evaluate();
693  if (expr.hasError())
694  qmlInfo(this, expr.error());
695  }
696 }
697 
699 {
700  ActionList rv;
702  a.event = this;
703  rv << a;
704  return rv;
705 }
706 
708 {
709  return QLatin1String("StateChangeScript");
710 }
711 
747 {
749 public:
751  : usedAnchors(0), resetAnchors(0), fill(0),
752  centerIn(0)/*, leftMargin(0), rightMargin(0), topMargin(0), bottomMargin(0),
753  margins(0), vCenterOffset(0), hCenterOffset(0), baselineOffset(0)*/
754  {
755  }
756 
757  QDeclarativeAnchors::Anchors usedAnchors;
758  QDeclarativeAnchors::Anchors resetAnchors;
759 
762 
770 
771  /*qreal leftMargin;
772  qreal rightMargin;
773  qreal topMargin;
774  qreal bottomMargin;
775  qreal margins;
776  qreal vCenterOffset;
777  qreal hCenterOffset;
778  qreal baselineOffset;*/
779 };
780 
782  : QObject(*new QDeclarativeAnchorSetPrivate, parent)
783 {
784 }
785 
787 {
788 }
789 
791 {
792  Q_D(const QDeclarativeAnchorSet);
793  return d->topScript;
794 }
795 
797 {
799  d->usedAnchors |= QDeclarativeAnchors::TopAnchor;
800  d->topScript = edge;
801  if (edge.script() == QLatin1String("undefined"))
802  resetTop();
803 }
804 
806 {
808  d->usedAnchors &= ~QDeclarativeAnchors::TopAnchor;
809  d->topScript = QDeclarativeScriptString();
810  d->resetAnchors |= QDeclarativeAnchors::TopAnchor;
811 }
812 
814 {
815  Q_D(const QDeclarativeAnchorSet);
816  return d->bottomScript;
817 }
818 
820 {
822  d->usedAnchors |= QDeclarativeAnchors::BottomAnchor;
823  d->bottomScript = edge;
824  if (edge.script() == QLatin1String("undefined"))
825  resetBottom();
826 }
827 
829 {
831  d->usedAnchors &= ~QDeclarativeAnchors::BottomAnchor;
832  d->bottomScript = QDeclarativeScriptString();
833  d->resetAnchors |= QDeclarativeAnchors::BottomAnchor;
834 }
835 
837 {
838  Q_D(const QDeclarativeAnchorSet);
839  return d->vCenterScript;
840 }
841 
843 {
845  d->usedAnchors |= QDeclarativeAnchors::VCenterAnchor;
846  d->vCenterScript = edge;
847  if (edge.script() == QLatin1String("undefined"))
849 }
850 
852 {
854  d->usedAnchors &= ~QDeclarativeAnchors::VCenterAnchor;
855  d->vCenterScript = QDeclarativeScriptString();
856  d->resetAnchors |= QDeclarativeAnchors::VCenterAnchor;
857 }
858 
860 {
861  Q_D(const QDeclarativeAnchorSet);
862  return d->baselineScript;
863 }
864 
866 {
868  d->usedAnchors |= QDeclarativeAnchors::BaselineAnchor;
869  d->baselineScript = edge;
870  if (edge.script() == QLatin1String("undefined"))
871  resetBaseline();
872 }
873 
875 {
877  d->usedAnchors &= ~QDeclarativeAnchors::BaselineAnchor;
878  d->baselineScript = QDeclarativeScriptString();
879  d->resetAnchors |= QDeclarativeAnchors::BaselineAnchor;
880 }
881 
883 {
884  Q_D(const QDeclarativeAnchorSet);
885  return d->leftScript;
886 }
887 
889 {
891  d->usedAnchors |= QDeclarativeAnchors::LeftAnchor;
892  d->leftScript = edge;
893  if (edge.script() == QLatin1String("undefined"))
894  resetLeft();
895 }
896 
898 {
900  d->usedAnchors &= ~QDeclarativeAnchors::LeftAnchor;
901  d->leftScript = QDeclarativeScriptString();
902  d->resetAnchors |= QDeclarativeAnchors::LeftAnchor;
903 }
904 
906 {
907  Q_D(const QDeclarativeAnchorSet);
908  return d->rightScript;
909 }
910 
912 {
914  d->usedAnchors |= QDeclarativeAnchors::RightAnchor;
915  d->rightScript = edge;
916  if (edge.script() == QLatin1String("undefined"))
917  resetRight();
918 }
919 
921 {
923  d->usedAnchors &= ~QDeclarativeAnchors::RightAnchor;
924  d->rightScript = QDeclarativeScriptString();
925  d->resetAnchors |= QDeclarativeAnchors::RightAnchor;
926 }
927 
929 {
930  Q_D(const QDeclarativeAnchorSet);
931  return d->hCenterScript;
932 }
933 
935 {
937  d->usedAnchors |= QDeclarativeAnchors::HCenterAnchor;
938  d->hCenterScript = edge;
939  if (edge.script() == QLatin1String("undefined"))
941 }
942 
944 {
946  d->usedAnchors &= ~QDeclarativeAnchors::HCenterAnchor;
947  d->hCenterScript = QDeclarativeScriptString();
948  d->resetAnchors |= QDeclarativeAnchors::HCenterAnchor;
949 }
950 
952 {
953  Q_D(const QDeclarativeAnchorSet);
954  return d->fill;
955 }
956 
958 {
960  d->fill = f;
961 }
962 
964 {
965  setFill(0);
966 }
967 
969 {
970  Q_D(const QDeclarativeAnchorSet);
971  return d->centerIn;
972 }
973 
975 {
977  d->centerIn = c;
978 }
979 
981 {
982  setCenterIn(0);
983 }
984 
985 
987 {
988 public:
990  : target(0), anchorSet(new QDeclarativeAnchorSet),
991  leftBinding(0), rightBinding(0), hCenterBinding(0),
992  topBinding(0), bottomBinding(0), vCenterBinding(0), baselineBinding(0),
993  origLeftBinding(0), origRightBinding(0), origHCenterBinding(0),
994  origTopBinding(0), origBottomBinding(0), origVCenterBinding(0),
995  origBaselineBinding(0)
996  {
997 
998  }
999  ~QDeclarativeAnchorChangesPrivate() { delete anchorSet; }
1000 
1003 
1011 
1019 
1027 
1032 
1037 
1042 
1050 
1055 
1057 
1065 };
1066 
1077 {
1078 }
1079 
1081 {
1082 }
1083 
1085 {
1087  d->leftBinding = d->rightBinding = d->hCenterBinding = d->topBinding
1088  = d->bottomBinding = d->vCenterBinding = d->baselineBinding = 0;
1089 
1090  d->leftProp = QDeclarativeProperty(d->target, QLatin1String("anchors.left"));
1091  d->rightProp = QDeclarativeProperty(d->target, QLatin1String("anchors.right"));
1092  d->hCenterProp = QDeclarativeProperty(d->target, QLatin1String("anchors.horizontalCenter"));
1093  d->topProp = QDeclarativeProperty(d->target, QLatin1String("anchors.top"));
1094  d->bottomProp = QDeclarativeProperty(d->target, QLatin1String("anchors.bottom"));
1095  d->vCenterProp = QDeclarativeProperty(d->target, QLatin1String("anchors.verticalCenter"));
1096  d->baselineProp = QDeclarativeProperty(d->target, QLatin1String("anchors.baseline"));
1097 
1098  QDeclarativeContext *ctxt = qmlContext(this);
1099 
1100  if (d->anchorSet->d_func()->usedAnchors & QDeclarativeAnchors::LeftAnchor) {
1101  d->leftBinding = new QDeclarativeBinding(d->anchorSet->d_func()->leftScript.script(), d->target, ctxt);
1102  d->leftBinding->setTarget(d->leftProp);
1103  }
1104  if (d->anchorSet->d_func()->usedAnchors & QDeclarativeAnchors::RightAnchor) {
1105  d->rightBinding = new QDeclarativeBinding(d->anchorSet->d_func()->rightScript.script(), d->target, ctxt);
1106  d->rightBinding->setTarget(d->rightProp);
1107  }
1108  if (d->anchorSet->d_func()->usedAnchors & QDeclarativeAnchors::HCenterAnchor) {
1109  d->hCenterBinding = new QDeclarativeBinding(d->anchorSet->d_func()->hCenterScript.script(), d->target, ctxt);
1110  d->hCenterBinding->setTarget(d->hCenterProp);
1111  }
1112  if (d->anchorSet->d_func()->usedAnchors & QDeclarativeAnchors::TopAnchor) {
1113  d->topBinding = new QDeclarativeBinding(d->anchorSet->d_func()->topScript.script(), d->target, ctxt);
1114  d->topBinding->setTarget(d->topProp);
1115  }
1116  if (d->anchorSet->d_func()->usedAnchors & QDeclarativeAnchors::BottomAnchor) {
1117  d->bottomBinding = new QDeclarativeBinding(d->anchorSet->d_func()->bottomScript.script(), d->target, ctxt);
1118  d->bottomBinding->setTarget(d->bottomProp);
1119  }
1120  if (d->anchorSet->d_func()->usedAnchors & QDeclarativeAnchors::VCenterAnchor) {
1121  d->vCenterBinding = new QDeclarativeBinding(d->anchorSet->d_func()->vCenterScript.script(), d->target, ctxt);
1122  d->vCenterBinding->setTarget(d->vCenterProp);
1123  }
1124  if (d->anchorSet->d_func()->usedAnchors & QDeclarativeAnchors::BaselineAnchor) {
1125  d->baselineBinding = new QDeclarativeBinding(d->anchorSet->d_func()->baselineScript.script(), d->target, ctxt);
1126  d->baselineBinding->setTarget(d->baselineProp);
1127  }
1128 
1130  a.event = this;
1131  return ActionList() << a;
1132 }
1133 
1135 {
1137  return d->anchorSet;
1138 }
1139 
1141 {
1143  return d->target;
1144 }
1145 
1147 {
1149  d->target = target;
1150 }
1151 
1177 {
1179  if (!d->target)
1180  return;
1181 
1182  QDeclarativeItemPrivate *targetPrivate = QDeclarativeItemPrivate::get(d->target);
1183  //incorporate any needed "reverts"
1184  if (d->applyOrigLeft) {
1185  if (!d->origLeftBinding)
1186  targetPrivate->anchors()->resetLeft();
1187  QDeclarativePropertyPrivate::setBinding(d->leftProp, d->origLeftBinding);
1188  }
1189  if (d->applyOrigRight) {
1190  if (!d->origRightBinding)
1191  targetPrivate->anchors()->resetRight();
1192  QDeclarativePropertyPrivate::setBinding(d->rightProp, d->origRightBinding);
1193  }
1194  if (d->applyOrigHCenter) {
1195  if (!d->origHCenterBinding)
1196  targetPrivate->anchors()->resetHorizontalCenter();
1197  QDeclarativePropertyPrivate::setBinding(d->hCenterProp, d->origHCenterBinding);
1198  }
1199  if (d->applyOrigTop) {
1200  if (!d->origTopBinding)
1201  targetPrivate->anchors()->resetTop();
1202  QDeclarativePropertyPrivate::setBinding(d->topProp, d->origTopBinding);
1203  }
1204  if (d->applyOrigBottom) {
1205  if (!d->origBottomBinding)
1206  targetPrivate->anchors()->resetBottom();
1207  QDeclarativePropertyPrivate::setBinding(d->bottomProp, d->origBottomBinding);
1208  }
1209  if (d->applyOrigVCenter) {
1210  if (!d->origVCenterBinding)
1211  targetPrivate->anchors()->resetVerticalCenter();
1212  QDeclarativePropertyPrivate::setBinding(d->vCenterProp, d->origVCenterBinding);
1213  }
1214  if (d->applyOrigBaseline) {
1215  if (!d->origBaselineBinding)
1216  targetPrivate->anchors()->resetBaseline();
1217  QDeclarativePropertyPrivate::setBinding(d->baselineProp, d->origBaselineBinding);
1218  }
1219 
1220  //destroy old bindings
1221  if (reason == ActualChange) {
1222  for (int i = 0; i < d->oldBindings.size(); ++i) {
1223  QDeclarativeAbstractBinding *binding = d->oldBindings.at(i);
1224  if (binding)
1225  binding->destroy();
1226  }
1227  d->oldBindings.clear();
1228  }
1229 
1230  //reset any anchors that have been specified as "undefined"
1231  if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::LeftAnchor) {
1232  targetPrivate->anchors()->resetLeft();
1234  }
1235  if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::RightAnchor) {
1236  targetPrivate->anchors()->resetRight();
1238  }
1239  if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::HCenterAnchor) {
1240  targetPrivate->anchors()->resetHorizontalCenter();
1241  QDeclarativePropertyPrivate::setBinding(d->hCenterProp, 0);
1242  }
1243  if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::TopAnchor) {
1244  targetPrivate->anchors()->resetTop();
1246  }
1247  if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::BottomAnchor) {
1248  targetPrivate->anchors()->resetBottom();
1250  }
1251  if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::VCenterAnchor) {
1252  targetPrivate->anchors()->resetVerticalCenter();
1253  QDeclarativePropertyPrivate::setBinding(d->vCenterProp, 0);
1254  }
1255  if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::BaselineAnchor) {
1256  targetPrivate->anchors()->resetBaseline();
1257  QDeclarativePropertyPrivate::setBinding(d->baselineProp, 0);
1258  }
1259 
1260  //set any anchors that have been specified
1261  if (d->leftBinding)
1262  QDeclarativePropertyPrivate::setBinding(d->leftBinding->property(), d->leftBinding);
1263  if (d->rightBinding)
1264  QDeclarativePropertyPrivate::setBinding(d->rightBinding->property(), d->rightBinding);
1265  if (d->hCenterBinding)
1266  QDeclarativePropertyPrivate::setBinding(d->hCenterBinding->property(), d->hCenterBinding);
1267  if (d->topBinding)
1268  QDeclarativePropertyPrivate::setBinding(d->topBinding->property(), d->topBinding);
1269  if (d->bottomBinding)
1270  QDeclarativePropertyPrivate::setBinding(d->bottomBinding->property(), d->bottomBinding);
1271  if (d->vCenterBinding)
1272  QDeclarativePropertyPrivate::setBinding(d->vCenterBinding->property(), d->vCenterBinding);
1273  if (d->baselineBinding)
1274  QDeclarativePropertyPrivate::setBinding(d->baselineBinding->property(), d->baselineBinding);
1275 }
1276 
1278 {
1279  return true;
1280 }
1281 
1283 {
1285  if (!d->target)
1286  return;
1287 
1288  QDeclarativeItemPrivate *targetPrivate = QDeclarativeItemPrivate::get(d->target);
1289  //reset any anchors set by the state
1290  if (d->leftBinding) {
1291  targetPrivate->anchors()->resetLeft();
1292  QDeclarativePropertyPrivate::setBinding(d->leftBinding->property(), 0);
1293  if (reason == ActualChange) {
1294  d->leftBinding->destroy(); d->leftBinding = 0;
1295  }
1296  }
1297  if (d->rightBinding) {
1298  targetPrivate->anchors()->resetRight();
1299  QDeclarativePropertyPrivate::setBinding(d->rightBinding->property(), 0);
1300  if (reason == ActualChange) {
1301  d->rightBinding->destroy(); d->rightBinding = 0;
1302  }
1303  }
1304  if (d->hCenterBinding) {
1305  targetPrivate->anchors()->resetHorizontalCenter();
1306  QDeclarativePropertyPrivate::setBinding(d->hCenterBinding->property(), 0);
1307  if (reason == ActualChange) {
1308  d->hCenterBinding->destroy(); d->hCenterBinding = 0;
1309  }
1310  }
1311  if (d->topBinding) {
1312  targetPrivate->anchors()->resetTop();
1313  QDeclarativePropertyPrivate::setBinding(d->topBinding->property(), 0);
1314  if (reason == ActualChange) {
1315  d->topBinding->destroy(); d->topBinding = 0;
1316  }
1317  }
1318  if (d->bottomBinding) {
1319  targetPrivate->anchors()->resetBottom();
1320  QDeclarativePropertyPrivate::setBinding(d->bottomBinding->property(), 0);
1321  if (reason == ActualChange) {
1322  d->bottomBinding->destroy(); d->bottomBinding = 0;
1323  }
1324  }
1325  if (d->vCenterBinding) {
1326  targetPrivate->anchors()->resetVerticalCenter();
1327  QDeclarativePropertyPrivate::setBinding(d->vCenterBinding->property(), 0);
1328  if (reason == ActualChange) {
1329  d->vCenterBinding->destroy(); d->vCenterBinding = 0;
1330  }
1331  }
1332  if (d->baselineBinding) {
1333  targetPrivate->anchors()->resetBaseline();
1334  QDeclarativePropertyPrivate::setBinding(d->baselineBinding->property(), 0);
1335  if (reason == ActualChange) {
1336  d->baselineBinding->destroy(); d->baselineBinding = 0;
1337  }
1338  }
1339 
1340  //restore previous anchors
1341  if (d->origLeftBinding)
1342  QDeclarativePropertyPrivate::setBinding(d->leftProp, d->origLeftBinding);
1343  if (d->origRightBinding)
1344  QDeclarativePropertyPrivate::setBinding(d->rightProp, d->origRightBinding);
1345  if (d->origHCenterBinding)
1346  QDeclarativePropertyPrivate::setBinding(d->hCenterProp, d->origHCenterBinding);
1347  if (d->origTopBinding)
1348  QDeclarativePropertyPrivate::setBinding(d->topProp, d->origTopBinding);
1349  if (d->origBottomBinding)
1350  QDeclarativePropertyPrivate::setBinding(d->bottomProp, d->origBottomBinding);
1351  if (d->origVCenterBinding)
1352  QDeclarativePropertyPrivate::setBinding(d->vCenterProp, d->origVCenterBinding);
1353  if (d->origBaselineBinding)
1354  QDeclarativePropertyPrivate::setBinding(d->baselineProp, d->origBaselineBinding);
1355 
1356  //restore any absolute geometry changed by the state's anchors
1357  QDeclarativeAnchors::Anchors stateVAnchors = d->anchorSet->d_func()->usedAnchors & QDeclarativeAnchors::Vertical_Mask;
1358  QDeclarativeAnchors::Anchors origVAnchors = targetPrivate->anchors()->usedAnchors() & QDeclarativeAnchors::Vertical_Mask;
1359  QDeclarativeAnchors::Anchors stateHAnchors = d->anchorSet->d_func()->usedAnchors & QDeclarativeAnchors::Horizontal_Mask;
1360  QDeclarativeAnchors::Anchors origHAnchors = targetPrivate->anchors()->usedAnchors() & QDeclarativeAnchors::Horizontal_Mask;
1361 
1362  bool stateSetWidth = (stateHAnchors &&
1363  stateHAnchors != QDeclarativeAnchors::LeftAnchor &&
1364  stateHAnchors != QDeclarativeAnchors::RightAnchor &&
1365  stateHAnchors != QDeclarativeAnchors::HCenterAnchor);
1366  bool origSetWidth = (origHAnchors &&
1367  origHAnchors != QDeclarativeAnchors::LeftAnchor &&
1368  origHAnchors != QDeclarativeAnchors::RightAnchor &&
1369  origHAnchors != QDeclarativeAnchors::HCenterAnchor);
1370  if (d->origWidth.isValid() && stateSetWidth && !origSetWidth)
1371  d->target->setWidth(d->origWidth.value);
1372 
1373  bool stateSetHeight = (stateVAnchors &&
1374  stateVAnchors != QDeclarativeAnchors::TopAnchor &&
1375  stateVAnchors != QDeclarativeAnchors::BottomAnchor &&
1376  stateVAnchors != QDeclarativeAnchors::VCenterAnchor &&
1377  stateVAnchors != QDeclarativeAnchors::BaselineAnchor);
1378  bool origSetHeight = (origVAnchors &&
1379  origVAnchors != QDeclarativeAnchors::TopAnchor &&
1380  origVAnchors != QDeclarativeAnchors::BottomAnchor &&
1381  origVAnchors != QDeclarativeAnchors::VCenterAnchor &&
1382  origVAnchors != QDeclarativeAnchors::BaselineAnchor);
1383  if (d->origHeight.isValid() && stateSetHeight && !origSetHeight)
1384  d->target->setHeight(d->origHeight.value);
1385 
1386  if (stateHAnchors && !origHAnchors)
1387  d->target->setX(d->origX);
1388 
1389  if (stateVAnchors && !origVAnchors)
1390  d->target->setY(d->origY);
1391 }
1392 
1394 {
1395  return QLatin1String("AnchorChanges");
1396 }
1397 
1399 {
1402 
1403  QDeclarativeAnchors::Anchors combined = d->anchorSet->d_func()->usedAnchors | d->anchorSet->d_func()->resetAnchors;
1404  bool hChange = combined & QDeclarativeAnchors::Horizontal_Mask;
1405  bool vChange = combined & QDeclarativeAnchors::Vertical_Mask;
1406 
1407  if (d->target) {
1408  QDeclarativeContext *ctxt = qmlContext(this);
1410  if (hChange && d->fromX != d->toX) {
1411  a.property = QDeclarativeProperty(d->target, QLatin1String("x"), ctxt);
1412  a.toValue = d->toX;
1413  extra << a;
1414  }
1415  if (vChange && d->fromY != d->toY) {
1416  a.property = QDeclarativeProperty(d->target, QLatin1String("y"), ctxt);
1417  a.toValue = d->toY;
1418  extra << a;
1419  }
1420  if (hChange && d->fromWidth != d->toWidth) {
1421  a.property = QDeclarativeProperty(d->target, QLatin1String("width"), ctxt);
1422  a.toValue = d->toWidth;
1423  extra << a;
1424  }
1425  if (vChange && d->fromHeight != d->toHeight) {
1426  a.property = QDeclarativeProperty(d->target, QLatin1String("height"), ctxt);
1427  a.toValue = d->toHeight;
1428  extra << a;
1429  }
1430  }
1431 
1432  return extra;
1433 }
1434 
1436 {
1437  return true;
1438 }
1439 
1441 {
1443  if (!d->target)
1444  return;
1445 
1446  d->origLeftBinding = QDeclarativePropertyPrivate::binding(d->leftProp);
1447  d->origRightBinding = QDeclarativePropertyPrivate::binding(d->rightProp);
1448  d->origHCenterBinding = QDeclarativePropertyPrivate::binding(d->hCenterProp);
1449  d->origTopBinding = QDeclarativePropertyPrivate::binding(d->topProp);
1450  d->origBottomBinding = QDeclarativePropertyPrivate::binding(d->bottomProp);
1451  d->origVCenterBinding = QDeclarativePropertyPrivate::binding(d->vCenterProp);
1452  d->origBaselineBinding = QDeclarativePropertyPrivate::binding(d->baselineProp);
1453 
1454  QDeclarativeItemPrivate *targetPrivate = QDeclarativeItemPrivate::get(d->target);
1455  if (targetPrivate->widthValid)
1456  d->origWidth = d->target->width();
1457  if (targetPrivate->heightValid)
1458  d->origHeight = d->target->height();
1459  d->origX = d->target->x();
1460  d->origY = d->target->y();
1461 
1462  d->applyOrigLeft = d->applyOrigRight = d->applyOrigHCenter = d->applyOrigTop
1463  = d->applyOrigBottom = d->applyOrigVCenter = d->applyOrigBaseline = false;
1464 
1466 }
1467 
1469 {
1471  QDeclarativeAnchorChanges *ac = static_cast<QDeclarativeAnchorChanges*>(other);
1472  QDeclarativeAnchorChangesPrivate *acp = ac->d_func();
1473 
1474  QDeclarativeAnchors::Anchors combined = acp->anchorSet->d_func()->usedAnchors |
1475  acp->anchorSet->d_func()->resetAnchors;
1476 
1477  //probably also need to revert some things
1478  d->applyOrigLeft = (combined & QDeclarativeAnchors::LeftAnchor);
1479  d->applyOrigRight = (combined & QDeclarativeAnchors::RightAnchor);
1480  d->applyOrigHCenter = (combined & QDeclarativeAnchors::HCenterAnchor);
1481  d->applyOrigTop = (combined & QDeclarativeAnchors::TopAnchor);
1482  d->applyOrigBottom = (combined & QDeclarativeAnchors::BottomAnchor);
1483  d->applyOrigVCenter = (combined & QDeclarativeAnchors::VCenterAnchor);
1484  d->applyOrigBaseline = (combined & QDeclarativeAnchors::BaselineAnchor);
1485 
1486  d->origLeftBinding = acp->origLeftBinding;
1487  d->origRightBinding = acp->origRightBinding;
1488  d->origHCenterBinding = acp->origHCenterBinding;
1489  d->origTopBinding = acp->origTopBinding;
1490  d->origBottomBinding = acp->origBottomBinding;
1491  d->origVCenterBinding = acp->origVCenterBinding;
1492  d->origBaselineBinding = acp->origBaselineBinding;
1493 
1494  d->origWidth = acp->origWidth;
1495  d->origHeight = acp->origHeight;
1496  d->origX = acp->origX;
1497  d->origY = acp->origY;
1498 
1499  d->oldBindings.clear();
1500  d->oldBindings << acp->leftBinding << acp->rightBinding << acp->hCenterBinding
1501  << acp->topBinding << acp->bottomBinding << acp->baselineBinding;
1502 
1504 }
1505 
1507 {
1509  if (!d->target)
1510  return;
1511 
1512  //### should this (saving "from" values) be moved to saveCurrentValues()?
1513  d->fromX = d->target->x();
1514  d->fromY = d->target->y();
1515  d->fromWidth = d->target->width();
1516  d->fromHeight = d->target->height();
1517 
1518  QDeclarativeItemPrivate *targetPrivate = QDeclarativeItemPrivate::get(d->target);
1519  //reset any anchors with corresponding reverts
1520  //reset any anchors that have been specified as "undefined"
1521  //reset any anchors that we'll be setting in the state
1522  QDeclarativeAnchors::Anchors combined = d->anchorSet->d_func()->resetAnchors |
1523  d->anchorSet->d_func()->usedAnchors;
1524  if (d->applyOrigLeft || (combined & QDeclarativeAnchors::LeftAnchor)) {
1525  targetPrivate->anchors()->resetLeft();
1527  }
1528  if (d->applyOrigRight || (combined & QDeclarativeAnchors::RightAnchor)) {
1529  targetPrivate->anchors()->resetRight();
1531  }
1532  if (d->applyOrigHCenter || (combined & QDeclarativeAnchors::HCenterAnchor)) {
1533  targetPrivate->anchors()->resetHorizontalCenter();
1534  QDeclarativePropertyPrivate::setBinding(d->hCenterProp, 0);
1535  }
1536  if (d->applyOrigTop || (combined & QDeclarativeAnchors::TopAnchor)) {
1537  targetPrivate->anchors()->resetTop();
1539  }
1540  if (d->applyOrigBottom || (combined & QDeclarativeAnchors::BottomAnchor)) {
1541  targetPrivate->anchors()->resetBottom();
1543  }
1544  if (d->applyOrigVCenter || (combined & QDeclarativeAnchors::VCenterAnchor)) {
1545  targetPrivate->anchors()->resetVerticalCenter();
1546  QDeclarativePropertyPrivate::setBinding(d->vCenterProp, 0);
1547  }
1548  if (d->applyOrigBaseline || (combined & QDeclarativeAnchors::BaselineAnchor)) {
1549  targetPrivate->anchors()->resetBaseline();
1550  QDeclarativePropertyPrivate::setBinding(d->baselineProp, 0);
1551  }
1552 }
1553 
1555 {
1556  if (other->typeName() != QLatin1String("AnchorChanges"))
1557  return false;
1558  if (static_cast<QDeclarativeActionEvent*>(this) == other)
1559  return true;
1560  if (static_cast<QDeclarativeAnchorChanges*>(other)->object() == object())
1561  return true;
1562  return false;
1563 }
1564 
1566 {
1568  if (!d->target)
1569  return;
1570 
1571  QDeclarativeItemPrivate *targetPrivate = QDeclarativeItemPrivate::get(d->target);
1572 
1573  //restore previous values (but not previous bindings, i.e. anchors)
1574  d->target->setX(d->rewindX);
1575  d->target->setY(d->rewindY);
1576  if (targetPrivate->widthValid) {
1577  d->target->setWidth(d->rewindWidth);
1578  }
1579  if (targetPrivate->heightValid) {
1580  d->target->setHeight(d->rewindHeight);
1581  }
1582 }
1583 
1585 {
1587  if (!d->target)
1588  return;
1589 
1590  QDeclarativeItemPrivate *targetPrivate = QDeclarativeItemPrivate::get(d->target);
1591  d->rewindLeft = targetPrivate->anchors()->left();
1592  d->rewindRight = targetPrivate->anchors()->right();
1593  d->rewindHCenter = targetPrivate->anchors()->horizontalCenter();
1594  d->rewindTop = targetPrivate->anchors()->top();
1595  d->rewindBottom = targetPrivate->anchors()->bottom();
1596  d->rewindVCenter = targetPrivate->anchors()->verticalCenter();
1597  d->rewindBaseline = targetPrivate->anchors()->baseline();
1598 
1599  d->rewindX = d->target->x();
1600  d->rewindY = d->target->y();
1601  d->rewindWidth = d->target->width();
1602  d->rewindHeight = d->target->height();
1603 }
1604 
1606 {
1608  if (!d->target)
1609  return;
1610 
1611  d->toX = d->target->x();
1612  d->toY = d->target->y();
1613  d->toWidth = d->target->width();
1614  d->toHeight = d->target->height();
1615 }
1616 
1617 #include <qdeclarativestateoperations.moc>
1618 #include <moc_qdeclarativestateoperations_p.cpp>
1619 
1621 
QDeclarativeNullableValue< QDeclarativeScriptString > rotationString
double d
Definition: qnumeric_p.h:62
void setLeft(const QDeclarativeScriptString &edge)
QDeclarativeGuard< QDeclarativeItem > parent
static QDeclarativeData * get(const QObject *object, bool create=false)
QDeclarativeProperty property
double qreal
Definition: qglobal.h:1193
unsigned char c[8]
Definition: qnumeric_p.h:62
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void tryReal(QDeclarativeNullableValue< qreal > &value, const QString &string)
QScopedPointer< QGraphicsItemPrivate > d_ptr
QDeclarativeAbstractBinding * origLeftBinding
QList< QDeclarativeAction > ActionList
QDeclarativeAnchorLine top
QDeclarativeNullableValue< qreal > rotation
QTransform itemTransform(const QGraphicsItem *other, bool *ok=0) const
Returns a QTransform that maps coordinates from this item to other.
QDeclarativeNullableValue< qreal > scale
QDeclarativeScriptString y() const
void scale(qreal sx, qreal sy)
Use.
void setCenterIn(QDeclarativeItem *)
QDeclarativeAnchors * anchors()
QDeclarativeNullableValue< QDeclarativeScriptString > xString
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
void setTarget(const QDeclarativeProperty &)
virtual void destroy(DestroyMode mode=DisconnectBinding)
Destroy the binding.
void doChange(QDeclarativeItem *targetParent, QDeclarativeItem *stackBefore=0)
QDeclarativeScriptString horizontalCenter() const
static QDeclarativeAbstractBinding * binding(QObject *, int coreIndex, int valueTypeIndex)
QDeclarativeAnchors::Anchors usedAnchors() const
qreal m22() const
Returns the vertical scaling factor.
Definition: qtransform.h:253
void setBaseline(const QDeclarativeScriptString &edge)
TransformOrigin transformOrigin
Returns the current transform origin.
QPointF transformOriginPoint
QDeclarativeScriptString right() const
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
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
QDeclarativeScriptString verticalCenter() const
QDeclarativeScriptString top() const
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
The QString class provides a Unicode character string.
Definition: qstring.h:83
T * qobject_cast(QObject *object)
Definition: qobject.h:375
QDeclarativeNullableValue< QDeclarativeScriptString > heightString
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 *)
QDeclarativeNullableValue< qreal > width
QDeclarativeAnchorLine baseline
#define Q_D(Class)
Definition: qglobal.h:2482
#define M_PI
Definition: qmath.h:261
QDeclarativeNullableValue< qreal > height
QList< QDeclarativeAbstractBinding * > oldBindings
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
#define Q_Q(Class)
Definition: qglobal.h:2483
QDeclarativeAnchorLine horizontalCenter
QDeclarativeGuard< QDeclarativeItem > origParent
QDeclarativeAnchorLine verticalCenter
void setParentItem(QDeclarativeItem *parent)
qreal m12() const
Returns the vertical shearing factor.
Definition: qtransform.h:241
virtual void execute(Reason reason=ActualChange)
QDeclarativeAbstractBinding * origRightBinding
QDeclarativeAbstractBinding * origTopBinding
QDeclarativeScriptString height() const
QDeclarativeScriptString width() const
QDeclarativeScriptString rotation() const
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QDeclarativeScriptString class encapsulates a script and its context.
QDeclarativeItem * object() const
QDeclarativeNullableValue< QDeclarativeScriptString > scaleString
QDeclarativeNullableValue< qreal > y
The QDeclarativeItem class provides the most basic of all visual items in QML.
QDeclarativeAnchors::Anchors usedAnchors
virtual void reverse(Reason reason=ActualChange)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
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
QDeclarativeScriptString baseline() const
static QDeclarativeItemPrivate * get(QDeclarativeItem *item)
void setHorizontalCenter(const QDeclarativeScriptString &edge)
QDeclarativeScriptString left() const
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...
void setRight(const QDeclarativeScriptString &edge)
static const char * data(const QByteArray &arr)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
QWeakPointer< QDeclarativeAbstractBinding > toBinding
QDeclarativeItem * centerIn() const
qreal rotation() const
Returns the clockwise rotation, in degrees, around the Z axis.
void setX(qreal x)
Set&#39;s the x coordinate of the item&#39;s position.
static QDeclarativeAbstractBinding * setBinding(QObject *, int coreIndex, int valueTypeIndex, QDeclarativeAbstractBinding *, WriteFlags flags=DontRemoveBinding)
QDeclarativeScriptString x() const
void setFill(QDeclarativeItem *)
void setVerticalCenter(const QDeclarativeScriptString &edge)
QDeclarativeScriptString script() const
QDeclarativeAbstractBinding * origBaselineBinding
#define Q_OBJECT
Definition: qobjectdefs.h:157
void setScript(const QDeclarativeScriptString &)
virtual QString typeName() const
void setBottom(const QDeclarativeScriptString &edge)
virtual void copyOriginals(QDeclarativeActionEvent *)
virtual void reverse(Reason reason=ActualChange)
#define Q_DECLARE_PRIVATE_D(Dptr, Class)
Definition: qglobal.h:2472
QDeclarativeAbstractBinding * origBottomBinding
QDeclarativeAnchorSet * anchors()
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
void setRotation(QDeclarativeScriptString rotation)
void setY(QDeclarativeScriptString y)
qreal y() const
This convenience function is equivalent to calling pos().
QDeclarativeItem * parentItem() const
Returns the QDeclarativeItem parent of this item.
QDeclarativeItem * fill() const
QDeclarativeAnchorLine left
virtual bool override(QDeclarativeActionEvent *other)
void stackBefore(const QGraphicsItem *sibling)
Stacks this item before sibling, which must be a sibling item (i.
QDeclarativeAnchors::Anchors resetAnchors
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
qreal x() const
This convenience function is equivalent to calling pos().
void setY(qreal y)
Set&#39;s the y coordinate of the item&#39;s position.
virtual bool override(QDeclarativeActionEvent *other)
QDeclarativeNullableValue< QDeclarativeScriptString > yString
QList< QDeclarativeAction > additionalActions()
QDeclarativeGuard< QDeclarativeItem > origStackBefore
const QObjectList & children() const
Returns a list of child objects.
Definition: qobject.h:197
void setScale(QDeclarativeScriptString scale)
QDeclarativeAnchorLine bottom
The QDeclarativeContext class defines a context within a QML engine.
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
The QDeclarativeProperty class abstracts accessing properties on objects created from QML...
QDeclarativeNullableValue< qreal > origWidth
void setScale(qreal scale)
Sets the scale factor of the item.
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 void execute(Reason reason=ActualChange)
QDeclarativeActionEvent * event
QDeclarativeNullableValue< QDeclarativeScriptString > widthString
virtual void execute(Reason reason=ActualChange)
QDeclarativeNullableValue< qreal > origHeight
QDeclarativeAbstractBinding * origHCenterBinding
void setX(QDeclarativeScriptString x)
QDeclarativeProperty property() const
The QDeclarativeExpression class evaluates JavaScript in a QML context.
QDeclarativeInfo qmlInfo(const QObject *me)
void setRotation(qreal angle)
Sets the clockwise rotation angle, in degrees, around the Z axis.
void setHeight(QDeclarativeScriptString height)
void setWidth(QDeclarativeScriptString width)
QDeclarativeScriptString bottom() const
qreal qSqrt(qreal v)
Definition: qmath.h:205
QDeclarativeAnchorLine right
QDeclarativeAbstractBinding * origVCenterBinding
void setTop(const QDeclarativeScriptString &edge)
QString script() const
Returns the script text.
QDeclarativeItem * parent() const
qreal m11() const
Returns the horizontal scaling factor.
Definition: qtransform.h:237
QDeclarativeItem * originalParent() const
QVariant read() const
Returns the property value.
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65
QDeclarativeNullableValue< qreal > x
QDeclarativeScriptString scale() const