Qt 4.8
Signals | Public Functions | Properties | List of all members
QDeclarativeState Class Reference

#include <qdeclarativestate_p.h>

Inheritance diagram for QDeclarativeState:
QObject

Signals

void completed ()
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 

Public Functions

void addEntriesToRevertList (const QList< QDeclarativeAction > &actions)
 
void addEntryToRevertList (const QDeclarativeAction &action)
 
void apply (QDeclarativeStateGroup *, QDeclarativeTransition *, QDeclarativeState *revert)
 
QDeclarativeAbstractBindingbindingInRevertList (QObject *target, const QString &name) const
 
void cancel ()
 
bool changeBindingInRevertList (QObject *target, const QString &name, QDeclarativeAbstractBinding *binding)
 
QDeclarativeListProperty< QDeclarativeStateOperationchanges ()
 
bool changeValueInRevertList (QObject *target, const QString &name, const QVariant &revertValue)
 
bool containsPropertyInRevertList (QObject *target, const QString &name) const
 
QString extends () const
 
bool isNamed () const
 
bool isStateActive () const
 
bool isWhenKnown () const
 
QString name () const
 
QDeclarativeStateOperationoperationAt (int) const
 
int operationCount () const
 
QDeclarativeStateoperator<< (QDeclarativeStateOperation *)
 
 QDeclarativeState (QObject *parent=0)
 
void removeAllEntriesFromRevertList (QObject *target)
 
bool removeEntryFromRevertList (QObject *target, const QString &name)
 
void setExtends (const QString &)
 
void setName (const QString &)
 
void setStateGroup (QDeclarativeStateGroup *)
 
void setWhen (QDeclarativeBinding *)
 
QDeclarativeStateGroupstateGroup () const
 
QVariant valueInRevertList (QObject *target, const QString &name) const
 
QDeclarativeBindingwhen () const
 
virtual ~QDeclarativeState ()
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool event (QEvent *)
 This virtual function receives events to an object and should return true if the event e was recognized and processed. More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 

Properties

QDeclarativeListProperty< QDeclarativeStateOperationchanges
 
QString extend
 
QString name
 
QDeclarativeBindingwhen
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Static Public Functions inherited from QObject
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 receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

Definition at line 143 of file qdeclarativestate_p.h.

Constructors and Destructors

◆ QDeclarativeState()

QDeclarativeState::QDeclarativeState ( QObject parent = 0)

Definition at line 167 of file qdeclarativestate.cpp.

168 : QObject(*(new QDeclarativeStatePrivate), parent)
169 {
171  d->transitionManager.setState(this);
172 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
Q_INVOKABLE QObject(QObject *parent=0)
Constructs an object with parent object parent.
Definition: qobject.cpp:753

◆ ~QDeclarativeState()

QDeclarativeState::~QDeclarativeState ( )
virtual

Definition at line 174 of file qdeclarativestate.cpp.

175 {
177  if (d->group)
178  d->group->removeState(this);
179 
180  /*
181  destroying an active state does not return us to the
182  base state, so we need to clean up our revert list to
183  prevent leaks. In the future we may want to redconsider
184  this overall architecture.
185  */
186  for (int i = 0; i < d->revertList.count(); ++i) {
187  if (d->revertList.at(i).binding()) {
188  d->revertList.at(i).binding()->destroy();
189  }
190  }
191 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

Functions

◆ addEntriesToRevertList()

void QDeclarativeState::addEntriesToRevertList ( const QList< QDeclarativeAction > &  actions)

Definition at line 525 of file qdeclarativestate.cpp.

Referenced by QDeclarativePropertyChanges::attachToState().

526 {
528  if (isStateActive()) {
529  QList<QDeclarativeSimpleAction> simpleActionList;
530 
531  QListIterator<QDeclarativeAction> actionListIterator(actionList);
532  while(actionListIterator.hasNext()) {
533  const QDeclarativeAction &action = actionListIterator.next();
534  QDeclarativeSimpleAction simpleAction(action);
535  action.property.write(action.toValue);
536  if (!action.toBinding.isNull()) {
537  QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::binding(simpleAction.property());
538  if (oldBinding)
539  QDeclarativePropertyPrivate::setBinding(simpleAction.property(), 0);
541  }
542 
543  simpleActionList.append(simpleAction);
544  }
545 
546  d->revertList.append(simpleActionList);
547  }
548 }
double d
Definition: qnumeric_p.h:62
QDeclarativeProperty property
static QDeclarativeAbstractBinding * binding(QObject *, int coreIndex, int valueTypeIndex)
bool isNull() const
Returns true if this object is holding a reference to a null pointer.
#define Q_D(Class)
Definition: qglobal.h:2482
T * data() const
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
QWeakPointer< QDeclarativeAbstractBinding > toBinding
static QDeclarativeAbstractBinding * setBinding(QObject *, int coreIndex, int valueTypeIndex, QDeclarativeAbstractBinding *, WriteFlags flags=DontRemoveBinding)
bool isStateActive() const
bool write(const QVariant &) const
Sets the property value to value and returns true.

◆ addEntryToRevertList()

void QDeclarativeState::addEntryToRevertList ( const QDeclarativeAction action)

Definition at line 490 of file qdeclarativestate.cpp.

Referenced by QDeclarativePropertyChanges::changeExpression(), and QDeclarativePropertyChanges::changeValue().

491 {
493 
494  QDeclarativeSimpleAction simpleAction(action);
495 
496  d->revertList.append(simpleAction);
497 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ apply()

void QDeclarativeState::apply ( QDeclarativeStateGroup group,
QDeclarativeTransition trans,
QDeclarativeState revert 
)

Definition at line 589 of file qdeclarativestate.cpp.

Referenced by QDeclarativeStateGroupPrivate::setCurrentStateInternal().

590 {
592 
593  qmlExecuteDeferred(this);
594 
595  cancel();
596  if (revert)
597  revert->cancel();
598  d->revertList.clear();
599  d->reverting.clear();
600 
601  if (revert) {
602  QDeclarativeStatePrivate *revertPrivate =
603  static_cast<QDeclarativeStatePrivate*>(revert->d_func());
604  d->revertList = revertPrivate->revertList;
605  revertPrivate->revertList.clear();
606  }
607 
608  // List of actions caused by this state
609  QDeclarativeStateOperation::ActionList applyList = d->generateActionList(group);
610 
611  // List of actions that need to be reverted to roll back (just) this state
613  // First add the reverse of all the applyList actions
614  for (int ii = 0; ii < applyList.count(); ++ii) {
615  QDeclarativeAction &action = applyList[ii];
616 
617  if (action.event) {
618  if (!action.event->isReversable())
619  continue;
620  bool found = false;
621  for (int jj = 0; jj < d->revertList.count(); ++jj) {
622  QDeclarativeActionEvent *event = d->revertList.at(jj).event();
623  if (event && event->typeName() == action.event->typeName()) {
624  if (action.event->override(event)) {
625  found = true;
626 
627  if (action.event != d->revertList.at(jj).event() && action.event->needsCopy()) {
628  action.event->copyOriginals(d->revertList.at(jj).event());
629 
630  QDeclarativeSimpleAction r(action);
631  additionalReverts << r;
632  d->revertList.removeAt(jj);
633  --jj;
634  } else if (action.event->isRewindable()) //###why needed?
635  action.event->saveCurrentValues();
636 
637  break;
638  }
639  }
640  }
641  if (!found) {
642  action.event->saveOriginals();
643  // Only need to revert the applyList action if the previous
644  // state doesn't have a higher priority revert already
645  QDeclarativeSimpleAction r(action);
646  additionalReverts << r;
647  }
648  } else {
649  bool found = false;
651 
652  for (int jj = 0; jj < d->revertList.count(); ++jj) {
653  if (d->revertList.at(jj).property() == action.property) {
654  found = true;
655  if (d->revertList.at(jj).binding() != action.fromBinding) {
656  action.deleteFromBinding();
657  }
658  break;
659  }
660  }
661 
662  if (!found) {
663  if (!action.restore) {
664  action.deleteFromBinding();;
665  } else {
666  // Only need to revert the applyList action if the previous
667  // state doesn't have a higher priority revert already
668  QDeclarativeSimpleAction r(action);
669  additionalReverts << r;
670  }
671  }
672  }
673  }
674 
675  // Any reverts from a previous state that aren't carried forth
676  // into this state need to be translated into apply actions
677  for (int ii = 0; ii < d->revertList.count(); ++ii) {
678  bool found = false;
679  if (d->revertList.at(ii).event()) {
680  QDeclarativeActionEvent *event = d->revertList.at(ii).event();
681  if (!event->isReversable())
682  continue;
683  for (int jj = 0; !found && jj < applyList.count(); ++jj) {
684  const QDeclarativeAction &action = applyList.at(jj);
685  if (action.event && action.event->typeName() == event->typeName()) {
686  if (action.event->override(event))
687  found = true;
688  }
689  }
690  } else {
691  for (int jj = 0; !found && jj < applyList.count(); ++jj) {
692  const QDeclarativeAction &action = applyList.at(jj);
693  if (action.property == d->revertList.at(ii).property())
694  found = true;
695  }
696  }
697  if (!found) {
698  QVariant cur = d->revertList.at(ii).property().read();
699  QDeclarativeAbstractBinding *delBinding =
700  QDeclarativePropertyPrivate::setBinding(d->revertList.at(ii).property(), 0);
701  if (delBinding)
702  delBinding->destroy();
703 
705  a.property = d->revertList.at(ii).property();
706  a.fromValue = cur;
707  a.toValue = d->revertList.at(ii).value();
708  a.toBinding = QDeclarativeAbstractBinding::getPointer(d->revertList.at(ii).binding());
709  a.specifiedObject = d->revertList.at(ii).specifiedObject();
710  a.specifiedProperty = d->revertList.at(ii).specifiedProperty();
711  a.event = d->revertList.at(ii).event();
712  a.reverseEvent = d->revertList.at(ii).reverseEvent();
713  if (a.event && a.event->isRewindable())
715  applyList << a;
716  // Store these special reverts in the reverting list
717  d->reverting << d->revertList.at(ii).property();
718  }
719  }
720  // All the local reverts now become part of the ongoing revertList
721  d->revertList << additionalReverts;
722 
723 #ifndef QT_NO_DEBUG_STREAM
724  // Output for debugging
725  if (stateChangeDebug()) {
726  foreach(const QDeclarativeAction &action, applyList) {
727  if (action.event)
728  qWarning() << " QDeclarativeAction event:" << action.event->typeName();
729  else
730  qWarning() << " QDeclarativeAction:" << action.property.object()
731  << action.property.name() << "From:" << action.fromValue
732  << "To:" << action.toValue;
733  }
734  }
735 #endif
736 
737  d->transitionManager.transition(applyList, trans);
738 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
double d
Definition: qnumeric_p.h:62
QDeclarativeProperty property
static Pointer getPointer(QDeclarativeAbstractBinding *p)
virtual void destroy(DestroyMode mode=DisconnectBinding)
Destroy the binding.
static QDeclarativeAbstractBinding * binding(QObject *, int coreIndex, int valueTypeIndex)
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
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
Definition: qobject.cpp:1200
#define Q_D(Class)
Definition: qglobal.h:2482
virtual bool override(QDeclarativeActionEvent *other)
QObject * object() const
Returns the QDeclarativeProperty&#39;s QObject.
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
Q_DECLARATIVE_EXPORT void qmlExecuteDeferred(QObject *)
Q_CORE_EXPORT void qWarning(const char *,...)
QWeakPointer< QDeclarativeAbstractBinding > toBinding
void clear()
Removes all items from the list.
Definition: qlist.h:764
static QDeclarativeAbstractBinding * setBinding(QObject *, int coreIndex, int valueTypeIndex, QDeclarativeAbstractBinding *, WriteFlags flags=DontRemoveBinding)
virtual QString typeName() const
QDeclarativeActionEvent * event
QString name() const
Return the name of this QML property.
virtual void copyOriginals(QDeclarativeActionEvent *)
QDeclarativeAbstractBinding * fromBinding

◆ bindingInRevertList()

QDeclarativeAbstractBinding * QDeclarativeState::bindingInRevertList ( QObject target,
const QString name 
) const

Definition at line 567 of file qdeclarativestate.cpp.

568 {
569  Q_D(const QDeclarativeState);
570 
571  if (isStateActive()) {
572  QListIterator<QDeclarativeSimpleAction> revertListIterator(d->revertList);
573 
574  while (revertListIterator.hasNext()) {
575  const QDeclarativeSimpleAction &simpleAction = revertListIterator.next();
576  if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name)
577  return simpleAction.binding();
578  }
579  }
580 
581  return 0;
582 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
QDeclarativeAbstractBinding * binding() const
const QString & specifiedProperty() const
bool isStateActive() const
QString name() const

◆ cancel()

void QDeclarativeState::cancel ( )

Definition at line 388 of file qdeclarativestate.cpp.

Referenced by apply().

389 {
391  d->transitionManager.cancel();
392 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ changeBindingInRevertList()

bool QDeclarativeState::changeBindingInRevertList ( QObject target,
const QString name,
QDeclarativeAbstractBinding binding 
)

Definition at line 439 of file qdeclarativestate.cpp.

Referenced by QDeclarativePropertyChanges::changeExpression().

440 {
442 
443  if (isStateActive()) {
444  QMutableListIterator<QDeclarativeSimpleAction> revertListIterator(d->revertList);
445 
446  while (revertListIterator.hasNext()) {
447  QDeclarativeSimpleAction &simpleAction = revertListIterator.next();
448  if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name) {
449  if (simpleAction.binding())
450  simpleAction.binding()->destroy();
451 
452  simpleAction.setBinding(binding);
453  return true;
454  }
455  }
456  }
457 
458  return false;
459 }
double d
Definition: qnumeric_p.h:62
virtual void destroy(DestroyMode mode=DisconnectBinding)
Destroy the binding.
void setBinding(QDeclarativeAbstractBinding *binding)
#define Q_D(Class)
Definition: qglobal.h:2482
QDeclarativeAbstractBinding * binding() const
const QString & specifiedProperty() const
bool isStateActive() const
QString name() const

◆ changes()

QDeclarativeListProperty<QDeclarativeStateOperation> QDeclarativeState::changes ( )

Referenced by setExtends().

◆ changeValueInRevertList()

bool QDeclarativeState::changeValueInRevertList ( QObject target,
const QString name,
const QVariant revertValue 
)

Definition at line 420 of file qdeclarativestate.cpp.

421 {
423 
424  if (isStateActive()) {
425  QMutableListIterator<QDeclarativeSimpleAction> revertListIterator(d->revertList);
426 
427  while (revertListIterator.hasNext()) {
428  QDeclarativeSimpleAction &simpleAction = revertListIterator.next();
429  if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name) {
430  simpleAction.setValue(revertValue);
431  return true;
432  }
433  }
434  }
435 
436  return false;
437 }
void setValue(const QVariant &value)
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
const QString & specifiedProperty() const
bool isStateActive() const
QString name() const

◆ completed

void QDeclarativeState::completed ( )
signal

◆ containsPropertyInRevertList()

bool QDeclarativeState::containsPropertyInRevertList ( QObject target,
const QString name 
) const

Definition at line 403 of file qdeclarativestate.cpp.

404 {
405  Q_D(const QDeclarativeState);
406 
407  if (isStateActive()) {
408  QListIterator<QDeclarativeSimpleAction> revertListIterator(d->revertList);
409 
410  while (revertListIterator.hasNext()) {
411  const QDeclarativeSimpleAction &simpleAction = revertListIterator.next();
412  if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name)
413  return true;
414  }
415  }
416 
417  return false;
418 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
const QString & specifiedProperty() const
bool isStateActive() const
QString name() const

◆ extends()

QString QDeclarativeState::extends ( ) const

Definition at line 280 of file qdeclarativestate.cpp.

Referenced by QDeclarativeStatePrivate::generateActionList(), and setExtends().

281 {
282  Q_D(const QDeclarativeState);
283  return d->extends;
284 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ isNamed()

bool QDeclarativeState::isNamed ( ) const

Definition at line 215 of file qdeclarativestate.cpp.

Referenced by QDeclarativeStateGroup::componentComplete(), and QDeclarativeStateGroupPrivate::updateAutoState().

216 {
217  Q_D(const QDeclarativeState);
218  return d->named;
219 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ isStateActive()

bool QDeclarativeState::isStateActive ( ) const

◆ isWhenKnown()

bool QDeclarativeState::isWhenKnown ( ) const

Definition at line 221 of file qdeclarativestate.cpp.

Referenced by QDeclarativeStateGroupPrivate::updateAutoState().

222 {
223  Q_D(const QDeclarativeState);
224  return d->when != 0;
225 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ name()

QString QDeclarativeState::name ( ) const

◆ operationAt()

QDeclarativeStateOperation * QDeclarativeState::operationAt ( int  index) const

Definition at line 318 of file qdeclarativestate.cpp.

319 {
320  Q_D(const QDeclarativeState);
321  return d->operations.at(index);
322 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
quint16 index

◆ operationCount()

int QDeclarativeState::operationCount ( ) const

Definition at line 312 of file qdeclarativestate.cpp.

313 {
314  Q_D(const QDeclarativeState);
315  return d->operations.count();
316 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ operator<<()

QDeclarativeState & QDeclarativeState::operator<< ( QDeclarativeStateOperation op)

Definition at line 324 of file qdeclarativestate.cpp.

325 {
327  d->operations.append(QDeclarativeStatePrivate::OperationGuard(op, &d->operations));
328  return *this;
329 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ removeAllEntriesFromRevertList()

void QDeclarativeState::removeAllEntriesFromRevertList ( QObject target)

Definition at line 499 of file qdeclarativestate.cpp.

Referenced by QDeclarativePropertyChanges::detachFromState().

500 {
502 
503  if (isStateActive()) {
504  QMutableListIterator<QDeclarativeSimpleAction> revertListIterator(d->revertList);
505 
506  while (revertListIterator.hasNext()) {
507  QDeclarativeSimpleAction &simpleAction = revertListIterator.next();
508  if (simpleAction.property().object() == target) {
510  if (oldBinding) {
512  oldBinding->destroy();
513  }
514 
515  simpleAction.property().write(simpleAction.value());
516  if (simpleAction.binding())
517  QDeclarativePropertyPrivate::setBinding(simpleAction.property(), simpleAction.binding());
518 
519  revertListIterator.remove();
520  }
521  }
522  }
523 }
double d
Definition: qnumeric_p.h:62
virtual void destroy(DestroyMode mode=DisconnectBinding)
Destroy the binding.
static QDeclarativeAbstractBinding * binding(QObject *, int coreIndex, int valueTypeIndex)
#define Q_D(Class)
Definition: qglobal.h:2482
QObject * object() const
Returns the QDeclarativeProperty&#39;s QObject.
QDeclarativeAbstractBinding * binding() const
static QDeclarativeAbstractBinding * setBinding(QObject *, int coreIndex, int valueTypeIndex, QDeclarativeAbstractBinding *, WriteFlags flags=DontRemoveBinding)
const QVariant & value() const
const QDeclarativeProperty & property() const
bool isStateActive() const
bool write(const QVariant &) const
Sets the property value to value and returns true.

◆ removeEntryFromRevertList()

bool QDeclarativeState::removeEntryFromRevertList ( QObject target,
const QString name 
)

Definition at line 461 of file qdeclarativestate.cpp.

Referenced by QDeclarativePropertyChanges::removeProperty().

462 {
464 
465  if (isStateActive()) {
466  QMutableListIterator<QDeclarativeSimpleAction> revertListIterator(d->revertList);
467 
468  while (revertListIterator.hasNext()) {
469  QDeclarativeSimpleAction &simpleAction = revertListIterator.next();
470  if (simpleAction.property().object() == target && simpleAction.property().name() == name) {
472  if (oldBinding) {
474  oldBinding->destroy();
475  }
476 
477  simpleAction.property().write(simpleAction.value());
478  if (simpleAction.binding())
479  QDeclarativePropertyPrivate::setBinding(simpleAction.property(), simpleAction.binding());
480 
481  revertListIterator.remove();
482  return true;
483  }
484  }
485  }
486 
487  return false;
488 }
double d
Definition: qnumeric_p.h:62
virtual void destroy(DestroyMode mode=DisconnectBinding)
Destroy the binding.
static QDeclarativeAbstractBinding * binding(QObject *, int coreIndex, int valueTypeIndex)
#define Q_D(Class)
Definition: qglobal.h:2482
QObject * object() const
Returns the QDeclarativeProperty&#39;s QObject.
QDeclarativeAbstractBinding * binding() const
static QDeclarativeAbstractBinding * setBinding(QObject *, int coreIndex, int valueTypeIndex, QDeclarativeAbstractBinding *, WriteFlags flags=DontRemoveBinding)
const QVariant & value() const
const QDeclarativeProperty & property() const
bool isStateActive() const
bool write(const QVariant &) const
Sets the property value to value and returns true.
QString name() const
QString name() const
Return the name of this QML property.

◆ setExtends()

void QDeclarativeState::setExtends ( const QString )

Definition at line 286 of file qdeclarativestate.cpp.

287 {
289  d->extends = extends;
290 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
QString extends() const

◆ setName()

void QDeclarativeState::setName ( const QString n)

Definition at line 208 of file qdeclarativestate.cpp.

Referenced by QDeclarativeStateGroup::componentComplete().

209 {
211  d->name = n;
212  d->named = true;
213 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ setStateGroup()

void QDeclarativeState::setStateGroup ( QDeclarativeStateGroup group)

Definition at line 382 of file qdeclarativestate.cpp.

Referenced by QDeclarativeStateGroupPrivate::append_state().

383 {
385  d->group = group;
386 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ setWhen()

void QDeclarativeState::setWhen ( QDeclarativeBinding when)

Definition at line 260 of file qdeclarativestate.cpp.

261 {
263  d->when = when;
264  if (d->group)
265  d->group->updateAutoState();
266 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
QDeclarativeBinding * when() const

◆ stateGroup()

QDeclarativeStateGroup * QDeclarativeState::stateGroup ( ) const

Definition at line 376 of file qdeclarativestate.cpp.

Referenced by isStateActive().

377 {
378  Q_D(const QDeclarativeState);
379  return d->group;
380 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ valueInRevertList()

QVariant QDeclarativeState::valueInRevertList ( QObject target,
const QString name 
) const

Definition at line 550 of file qdeclarativestate.cpp.

551 {
552  Q_D(const QDeclarativeState);
553 
554  if (isStateActive()) {
555  QListIterator<QDeclarativeSimpleAction> revertListIterator(d->revertList);
556 
557  while (revertListIterator.hasNext()) {
558  const QDeclarativeSimpleAction &simpleAction = revertListIterator.next();
559  if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name)
560  return simpleAction.value();
561  }
562  }
563 
564  return QVariant();
565 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
const QString & specifiedProperty() const
const QVariant & value() const
bool isStateActive() const
QString name() const

◆ when()

QDeclarativeBinding* QDeclarativeState::when ( ) const

Referenced by isWhenKnown(), and setWhen().

Properties

◆ changes

QDeclarativeListProperty< QDeclarativeStateOperation > QDeclarativeState::changes
private

Definition at line 150 of file qdeclarativestate_p.h.

◆ extend

QString QDeclarativeState::extend
private

Definition at line 149 of file qdeclarativestate_p.h.

◆ name

QString QDeclarativeState::name
private

◆ when

QDeclarativeBinding * QDeclarativeState::when
private

The documentation for this class was generated from the following files: