42 #include "private/qdeclarativestate_p_p.h" 43 #include "private/qdeclarativestate_p.h" 45 #include "private/qdeclarativetransition_p.h" 46 #include "private/qdeclarativestategroup_p.h" 47 #include "private/qdeclarativestateoperations_p.h" 48 #include "private/qdeclarativeanimation_p.h" 49 #include "private/qdeclarativeanimation_p_p.h" 54 #include <QtCore/qdebug.h> 61 : restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), fromBinding(0),
event(0),
171 d->transitionManager.setState(
this);
178 d->group->removeState(
this);
186 for (
int i = 0; i <
d->revertList.count(); ++i) {
187 if (
d->revertList.at(i).binding()) {
188 d->revertList.at(i).binding()->destroy();
265 d->group->updateAutoState();
315 return d->operations.count();
321 return d->operations.at(index);
335 for (
int ii = 0; ii < reverting.count(); ++ii) {
336 for (
int jj = 0; jj < revertList.count(); ++jj) {
337 if (revertList.at(jj).property() == reverting.at(ii)) {
338 revertList.removeAt(jj);
362 for (
int ii = 0; ii < states.
count(); ++ii)
391 d->transitionManager.cancel();
398 fromBinding->destroy();
408 QListIterator<QDeclarativeSimpleAction> revertListIterator(
d->revertList);
410 while (revertListIterator.hasNext()) {
425 QMutableListIterator<QDeclarativeSimpleAction> revertListIterator(
d->revertList);
427 while (revertListIterator.hasNext()) {
444 QMutableListIterator<QDeclarativeSimpleAction> revertListIterator(
d->revertList);
446 while (revertListIterator.hasNext()) {
466 QMutableListIterator<QDeclarativeSimpleAction> revertListIterator(
d->revertList);
468 while (revertListIterator.hasNext()) {
481 revertListIterator.remove();
496 d->revertList.append(simpleAction);
504 QMutableListIterator<QDeclarativeSimpleAction> revertListIterator(
d->revertList);
506 while (revertListIterator.hasNext()) {
519 revertListIterator.remove();
531 QListIterator<QDeclarativeAction> actionListIterator(actionList);
532 while(actionListIterator.hasNext()) {
543 simpleActionList.
append(simpleAction);
546 d->revertList.append(simpleActionList);
555 QListIterator<QDeclarativeSimpleAction> revertListIterator(
d->revertList);
557 while (revertListIterator.hasNext()) {
560 return simpleAction.
value();
572 QListIterator<QDeclarativeSimpleAction> revertListIterator(
d->revertList);
574 while (revertListIterator.hasNext()) {
598 d->revertList.clear();
599 d->reverting.clear();
614 for (
int ii = 0; ii < applyList.
count(); ++ii) {
621 for (
int jj = 0; jj <
d->revertList.count(); ++jj) {
631 additionalReverts << r;
632 d->revertList.removeAt(jj);
646 additionalReverts << r;
652 for (
int jj = 0; jj <
d->revertList.count(); ++jj) {
653 if (
d->revertList.at(jj).property() == action.
property) {
655 if (
d->revertList.at(jj).binding() != action.
fromBinding) {
669 additionalReverts << r;
677 for (
int ii = 0; ii <
d->revertList.count(); ++ii) {
679 if (
d->revertList.at(ii).event()) {
681 if (!
event->isReversable())
683 for (
int jj = 0; !found && jj < applyList.
count(); ++jj) {
691 for (
int jj = 0; !found && jj < applyList.
count(); ++jj) {
693 if (action.
property ==
d->revertList.at(ii).property())
698 QVariant cur =
d->revertList.at(ii).property().read();
705 a.
property =
d->revertList.at(ii).property();
707 a.
toValue =
d->revertList.at(ii).value();
711 a.
event =
d->revertList.at(ii).event();
717 d->reverting <<
d->revertList.at(ii).property();
721 d->revertList << additionalReverts;
723 #ifndef QT_NO_DEBUG_STREAM 725 if (stateChangeDebug()) {
737 d->transitionManager.transition(applyList, trans);
The QVariant class acts like a union for the most common Qt data types.
void setValue(const QVariant &value)
virtual void clearBindings()
QDeclarativeProperty property
#define QT_END_NAMESPACE
This macro expands to.
QObject * specifiedObject() const
virtual bool isRewindable()
QDeclarativeStateGroup * stateGroup() const
static Pointer getPointer(QDeclarativeAbstractBinding *p)
virtual bool changesBindings()
QDeclarativeState(QObject *parent=0)
int operationCount() const
virtual void destroy(DestroyMode mode=DisconnectBinding)
Destroy the binding.
static QDeclarativeAbstractBinding * binding(QObject *, int coreIndex, int valueTypeIndex)
void removeAllEntriesFromRevertList(QObject *target)
void setBinding(QDeclarativeAbstractBinding *binding)
long ASN1_INTEGER_get ASN1_INTEGER * a
int count(const T &t) const
Returns the number of occurrences of value in the list.
virtual ActionList actions()
The QString class provides a Unicode character string.
bool isNull() const
Returns true if this object is holding a reference to a null pointer.
The QObject class is the base class of all Qt objects.
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
virtual ~QDeclarativeState()
bool isValid() const
Returns true if the QDeclarativeProperty refers to a valid property, otherwise false.
void addEntriesToRevertList(const QList< QDeclarativeAction > &actions)
static void operations_clear(QDeclarativeListProperty< QDeclarativeStateOperation > *prop)
virtual bool override(QDeclarativeActionEvent *other)
QDeclarativeBinding * when() const
QObject * object() const
Returns the QDeclarativeProperty's QObject.
void append(const T &t)
Inserts value at the end of the list.
virtual void saveOriginals()
#define QT_BEGIN_NAMESPACE
This macro expands to.
QDeclarativeStateOperation * operationAt(int) const
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void setState(QDeclarativeState *state)
Q_DECLARATIVE_EXPORT void qmlExecuteDeferred(QObject *)
const T & at(int i) const
Returns the item at index position i in the list.
QDeclarativeStateOperation::ActionList generateActionList(QDeclarativeStateGroup *) const
Q_CORE_EXPORT void qWarning(const char *,...)
QDeclarativeState * state() const
QDeclarativeAbstractBinding * binding() const
QVariant valueInRevertList(QObject *target, const QString &name) const
virtual void execute(Reason reason=ActualChange)
QWeakPointer< QDeclarativeAbstractBinding > toBinding
const QString & specifiedProperty() const
void clear()
Removes all items from the list.
static QDeclarativeAbstractBinding * setBinding(QObject *, int coreIndex, int valueTypeIndex, QDeclarativeAbstractBinding *, WriteFlags flags=DontRemoveBinding)
void setExtends(const QString &)
void setName(const QString &)
const QVariant & value() const
bool changeBindingInRevertList(QObject *target, const QString &name, QDeclarativeAbstractBinding *binding)
virtual QString typeName() const
DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG)
QDeclarativeState & operator<<(QDeclarativeStateOperation *)
virtual ~QDeclarativeActionEvent()
static void operations_append(QDeclarativeListProperty< QDeclarativeStateOperation > *prop, QDeclarativeStateOperation *op)
Q_DECLARATIVE_EXPORT QDeclarativeEngine * qmlEngine(const QObject *)
bool removeEntryFromRevertList(QObject *target, const QString &name)
void addEntryToRevertList(const QDeclarativeAction &action)
void setWhen(QDeclarativeBinding *)
QObject * parent() const
Returns a pointer to the parent object.
virtual bool isReversable()
QObject * specifiedObject
bool changeValueInRevertList(QObject *target, const QString &name, const QVariant &revertValue)
SimpleActionList revertList
void apply(QDeclarativeStateGroup *, QDeclarativeTransition *, QDeclarativeState *revert)
The QDeclarativeContext class defines a context within a QML engine.
const QDeclarativeProperty & property() const
bool isStateActive() const
QVariant property(const char *name) const
Returns the value of the object's name property.
QString specifiedProperty
bool write(const QVariant &) const
Sets the property value to value and returns true.
QDeclarativeActionEvent * event
QDeclarativeStateOperation(QObject *parent=0)
QDeclarativeListProperty< QDeclarativeState > states
bool containsPropertyInRevertList(QObject *target, const QString &name) const
QDeclarativeAbstractBinding * bindingInRevertList(QObject *target, const QString &name) const
static QDeclarativeStateOperation * operations_at(QDeclarativeListProperty< QDeclarativeStateOperation > *prop, int index)
QString name() const
Return the name of this QML property.
QDeclarativeListProperty< QDeclarativeStateOperation > changes()
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
virtual void copyOriginals(QDeclarativeActionEvent *)
virtual void reverse(Reason reason=ActualChange)
static int operations_count(QDeclarativeListProperty< QDeclarativeStateOperation > *prop)
QVariant read() const
Returns the property value.
virtual void saveCurrentValues()
QDeclarativeAbstractBinding * fromBinding
void setStateGroup(QDeclarativeStateGroup *)