44 #ifndef QT_NO_STATEMACHINE 59 #include "private/qobject_p.h" 60 #include "private/qthread_p.h" 62 #ifndef QT_NO_STATEMACHINE_EVENTFILTER 67 #ifndef QT_NO_ANIMATION 70 #include <private/qvariantanimation_p.h> 73 #include <QtCore/qmetaobject.h> 173 #ifndef QT_NO_ANIMATION 203 #ifndef QT_NO_ANIMATION 232 return new QTimerEvent(*static_cast<QTimerEvent*>(e));
234 Q_ASSERT_X(
false,
"cloneEvent()",
"not implemented");
254 for (
int i = 0; i < childStates.
size(); ++i) {
304 for (
int i = 0; i < ancestors.
size(); ++i) {
307 for (
int j = states.
size() - 1; (j > 0) && ok; --j) {
328 #ifdef QSTATEMACHINE_DEBUG 329 qDebug() << q_func() <<
':' << transitions <<
"preempts selection of a transition from" 330 << s <<
"because" << s <<
"is a descendant of" << lca;
344 const_cast<QStateMachine*
>(q)->beginSelectTransitions(event);
355 for (
int j = 0; (j < lst.
size()) && !found; ++j) {
358 for (
int k = 0; k < transitions.
size(); ++k) {
361 #ifdef QSTATEMACHINE_DEBUG 362 qDebug() << q <<
": selecting transition" << t;
364 enabledTransitions.
insert(t);
372 return enabledTransitions;
377 #ifdef QSTATEMACHINE_DEBUG 378 qDebug() << q_func() <<
": begin microstep( enabledTransitions:" << enabledTransitions <<
')';
382 #ifdef QSTATEMACHINE_DEBUG 387 #ifndef QT_NO_PROPERTIES 390 #ifdef QSTATEMACHINE_DEBUG 392 qDebug() << q_func() <<
": end microstep";
401 for (
int i = 0; i < enabledTransitions.
size(); ++i) {
428 for (
int i = 0; i < statesToExit_sorted.
size(); ++i) {
432 for (
int j = 0; j < hlst.
size(); ++j) {
445 #ifdef QSTATEMACHINE_DEBUG 452 for (
int i = 0; i < statesToExit_sorted.
size(); ++i) {
454 #ifdef QSTATEMACHINE_DEBUG 455 qDebug() << q_func() <<
": exiting" << s;
461 return statesToExit_sorted;
466 for (
int i = 0; i < enabledTransitions.
size(); ++i) {
468 #ifdef QSTATEMACHINE_DEBUG 469 qDebug() << q_func() <<
": triggering" << t;
478 #ifdef QSTATEMACHINE_DEBUG 486 for (
int i = 0; i < enabledTransitions.
size(); ++i) {
493 for (
int j = 1; j < lst.
size(); ++j) {
509 statesToEnter.
clear();
519 for (
int i = 0; i < statesToEnter_sorted.
size(); ++i) {
521 #ifdef QSTATEMACHINE_DEBUG 522 qDebug() << q <<
": entering" << s;
528 if (statesForDefaultEntry.
contains(s)) {
535 #ifdef QSTATEMACHINE_DEBUG 536 qDebug() << q <<
": emitting finished signal for" <<
parent;
542 bool allChildStatesFinal =
true;
544 for (
int j = 0; j < childStates.
size(); ++j) {
547 allChildStatesFinal =
false;
551 if (allChildStatesFinal && (grandparent !=
rootState())) {
552 #ifdef QSTATEMACHINE_DEBUG 553 qDebug() << q <<
": emitting finished signal for" << grandparent;
572 return statesToEnter_sorted;
582 for (
int k = 0; k < hconf.
size(); ++k) {
586 #ifdef QSTATEMACHINE_DEBUG 587 qDebug() <<q_func() <<
": restoring" 589 <<
"history from" << s <<
':' << hconf;
599 for (
int k = 0; k < hlst.
size(); ++k) {
603 #ifdef QSTATEMACHINE_DEBUG 604 qDebug() << q_func() <<
": initial history targets for" << s <<
':' << hlst;
618 for (
int i = 0; i < lst.
size(); ++i) {
623 statesForDefaultEntry.
insert(s);
635 for (
int i = 0; i < ancs.
size(); ++i) {
639 statesToEnter.
insert(anc);
642 for (
int j = 0; j < lst.
size(); ++j) {
644 bool hasDescendantInList =
false;
648 hasDescendantInList =
true;
652 if (!hasDescendantInList)
660 #ifndef QT_NO_PROPERTIES 666 #ifdef QT_NO_ANIMATION 675 for (
int i = 0; i < enteredStates.
size(); ++i) {
681 for (
int j = 0; j < assignments.
size(); ++j) {
687 propertyAssignmentsForState[s].append(assn);
694 while ((parentState = parentState->
parentState()) != 0) {
696 for (
int j=0; j<assignments.
size(); ++j) {
700 propertyAssignmentsForState[s].append(assn);
704 if (!pendingRestorables.
isEmpty()) {
707 s = enteredStates.
last();
713 #ifndef QT_NO_ANIMATION 715 for (
int i = 0; i < exitedStates.
size(); ++i) {
718 for (
int j = 0; j < animations.
size(); ++j) {
727 topLevelAnim = group;
728 topLevelAnim->
stop();
740 for (it = propertyAssignmentsForState.
constBegin(); it != propertyAssignmentsForState.
constEnd(); ++
it) {
742 for (
int k = 0; k < assignments.
size(); ++k) {
759 for (
int i = 0; i < transitionList.
size(); ++i) {
762 selectedAnimations << transition->
animations();
766 for (
int j=0; j<targetStates.
size(); ++j)
773 for (
int i = 0; i < selectedAnimations.
size(); ++i) {
776 for (it = propertyAssignmentsForState.
begin(); it != propertyAssignmentsForState.
end(); ) {
780 for (it2 = assignments.
begin(); it2 != assignments.
end(); ) {
785 for (
int j = 0; j < handlers.
size(); ++j) {
793 it2 = assignments.
erase(it2);
797 for (
int j = 0; j < ret.
second.size(); ++j)
801 it = propertyAssignmentsForState.
erase(it);
811 bool hasValidEndValue =
false;
812 for (
int j = 0; j < variantAnims.
size(); ++j) {
814 hasValidEndValue =
true;
819 if (hasValidEndValue) {
831 #endif // !QT_NO_ANIMATION 836 for (it = propertyAssignmentsForState.
constBegin(); it != propertyAssignmentsForState.
constEnd(); ++
it) {
838 for (
int i = 0; i < assignments.
size(); ++i) {
846 for (
int i = 0; i < enteredStates.
size(); ++i) {
849 #ifndef QT_NO_ANIMATION
857 #endif // QT_NO_PROPERTIES 946 for (
int i = 0; i < lst.
size(); ++i) {
955 for (
int i = 0; i < lst.
size(); ++i) {
966 #ifndef QT_NO_PROPERTIES 1015 #endif // QT_NO_PROPERTIES 1026 if (errorState == 0)
1038 switch (errorCode) {
1069 if (currentContext == currentErrorState)
1070 currentErrorState = 0;
1074 if (currentErrorState != 0) {
1078 qWarning(
"Unrecoverable error detected in running state machine: %s",
1084 #ifndef QT_NO_ANIMATION 1098 handledAnimations << ret.
first;
1099 localResetEndValues << ret.
second;
1110 localResetEndValues.
append(animation);
1112 handledAnimations.
append(animation);
1115 return qMakePair(handledAnimations, localResetEndValues);
1129 #ifndef QT_NO_PROPERTIES 1144 animations.removeOne(anim);
1145 if (animations.isEmpty()) {
1151 #endif // !QT_NO_ANIMATION 1155 class StartState :
public QState 1161 void onEntry(
QEvent *) {}
1170 { setTargetState(target); }
1172 virtual bool eventTest(
QEvent *) {
return true; }
1173 virtual void onTransition(
QEvent *) {}
1196 for (
int i = 0; i < historyStates.
size(); ++i) {
1215 #ifdef QSTATEMACHINE_DEBUG 1216 qDebug() << q <<
": starting";
1232 transitions.
append(initialTransition);
1238 #ifndef QT_NO_PROPERTIES 1244 #ifdef QSTATEMACHINE_DEBUG 1257 #ifdef QSTATEMACHINE_DEBUG 1258 qDebug() << q <<
": starting the event processing loop";
1268 if (enabledTransitions.
isEmpty()) {
1273 #ifdef QSTATEMACHINE_DEBUG 1274 qDebug() << q <<
": dequeued internal event" << e <<
"of type" << e->
type();
1277 if (enabledTransitions.
isEmpty()) {
1282 if (enabledTransitions.
isEmpty()) {
1284 #ifdef QSTATEMACHINE_DEBUG 1285 qDebug() << q <<
": dequeued external event" << e <<
"of type" << e->
type();
1288 if (enabledTransitions.
isEmpty()) {
1299 if (!enabledTransitions.
isEmpty()) {
1300 q->beginMicrostep(e);
1304 #ifdef QSTATEMACHINE_DEBUG 1306 qDebug() << q <<
": no transitions enabled";
1311 #ifdef QSTATEMACHINE_DEBUG 1312 qDebug() << q <<
": finished the event processing loop";
1382 switch (processingMode) {
1416 { setTargetState(target); }
1443 qWarning(
"QStateMachine::goToState(): cannot go to null state");
1455 if (sourceState != 0)
1482 for (
int i = 0; i < transitions.
size(); ++i) {
1487 #ifndef QT_NO_STATEMACHINE_EVENTFILTER 1500 #ifndef QT_NO_STATEMACHINE_EVENTFILTER 1501 else if (
QEventTransition *oet = qobject_cast<QEventTransition*>(transition)) {
1521 if (signalIndex == -1) {
1523 if (signalIndex == -1) {
1524 qWarning(
"QSignalTransition: no such signal: %s::%s",
1536 connectedSignalIndexes.
resize(signalIndex+1);
1537 if (connectedSignalIndexes.
at(signalIndex) == 0) {
1543 #ifdef QSTATEMACHINE_DEBUG 1544 qDebug() << q <<
": FAILED to add signal transition from" << transition->
sourceState()
1545 <<
": ( sender =" << sender <<
", signal =" << signal
1554 #ifdef QSTATEMACHINE_DEBUG 1556 <<
": ( sender =" << sender <<
", signal =" << signal
1564 if (signalIndex == -1)
1570 Q_ASSERT(connectedSignalIndexes.
at(signalIndex) != 0);
1571 if (--connectedSignalIndexes[signalIndex] == 0) {
1576 for (
int i = 0; i < connectedSignalIndexes.
size(); ++i)
1577 sum += connectedSignalIndexes.
at(i);
1588 for (
int i = 0; i < transitions.
size(); ++i) {
1596 for (
int i = 0; i < transitions.
size(); ++i) {
1604 #ifndef QT_NO_STATEMACHINE_EVENTFILTER 1611 qWarning(
"QObject event transitions are not supported for custom types");
1622 #ifdef QSTATEMACHINE_DEBUG 1624 <<
": ( object =" <<
object <<
", event =" << transition->
eventType()
1637 if (--events[transition->
eventType()] == 0) {
1645 object->removeEventFilter(q);
1667 int argc = parameterTypes.
count();
1669 for (
int i = 0; i < argc; ++i) {
1674 #ifdef QSTATEMACHINE_DEBUG 1675 qDebug() << q_func() <<
": sending signal event ( sender =" << sender
1794 return d->errorString;
1803 d->errorString.clear();
1815 return d->globalRestorePolicy;
1827 d->globalRestorePolicy = restorePolicy;
1842 qWarning(
"QStateMachine::addState: cannot add null state");
1846 qWarning(
"QStateMachine::addState: state has already been added to this machine");
1861 qWarning(
"QStateMachine::removeState: cannot remove null state");
1865 qWarning(
"QStateMachine::removeState: state %p's machine (%p)" 1866 " is different from this machine (%p)",
1900 qWarning(
"QStateMachine::start: No initial state set for machine. Refusing to start.");
1912 qWarning(
"QStateMachine::start(): already running");
1961 qWarning(
"QStateMachine::postEvent: cannot post event when the state machine is not running");
1965 qWarning(
"QStateMachine::postEvent: cannot post null event");
1968 #ifdef QSTATEMACHINE_DEBUG 1973 d->postExternalEvent(event);
1976 d->postInternalEvent(event);
2005 qWarning(
"QStateMachine::postDelayedEvent: cannot post event when the state machine is not running");
2009 qWarning(
"QStateMachine::postDelayedEvent: cannot post null event");
2013 qWarning(
"QStateMachine::postDelayedEvent: delay cannot be negative");
2016 #ifdef QSTATEMACHINE_DEBUG 2017 qDebug() <<
this <<
": posting event" <<
event <<
"with delay" << delay;
2021 d->delayedEvents[tid] =
event;
2041 qWarning(
"QStateMachine::cancelDelayedEvent: the machine is not running");
2045 QEvent *e =
d->delayedEvents.take(
id);
2063 return d->configuration;
2101 Q_ASSERT(!
d->delayedEvents.contains(tid));
2104 d->delayedEventsMutex.lock();
2105 QEvent *ee =
d->delayedEvents.take(tid);
2108 d->delayedEventsMutex.unlock();
2109 d->postExternalEvent(ee);
2113 d->delayedEventsMutex.unlock();
2119 #ifndef QT_NO_STATEMACHINE_EVENTFILTER 2126 d->handleFilteredEvent(watched, event);
2221 #ifndef QT_NO_ANIMATION 2247 d->defaultAnimations.append(animation);
2256 return d->defaultAnimations;
2265 d->defaultAnimations.removeAll(animation);
2268 #endif // QT_NO_ANIMATION 2283 23, 22, 22, 22, 0x0a,
2289 "QSignalEventGenerator\0\0execute()\0" 2304 if (!_clname)
return 0;
2307 return QObject::qt_metacast(_clname);
2312 _id = QObject::qt_metacall(_c, _id, _a);
2320 int signalIndex = -1;
2375 :
QEvent(
QEvent::StateMachineSignal), m_sender(sender),
2376 m_signalIndex(signalIndex), m_arguments(arguments)
2485 #include "moc_qstatemachine.cpp" 2487 #endif //QT_NO_STATEMACHINE The QVariant class acts like a union for the most common Qt data types.
T qobject_cast(QObject *object)
int startTimer(int interval)
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer...
void removeState(QAbstractState *state)
Removes the given state from this state machine.
void callOnEntry(QEvent *e)
QAbstractState * findErrorState(QAbstractState *context)
QVariant endValue
the end value of the animation
QSignalEventGenerator(QStateMachine *parent)
QStateMachine::RestorePolicy globalRestorePolicy
The QHash::const_iterator class provides an STL-style const iterator for QHash and QMultiHash...
static QEventTransitionPrivate * get(QEventTransition *q)
The QPropertyAnimation class animates Qt properties.
QAbstractAnimation * animationAt(int index) const
Returns a pointer to the animation at index in this group.
void onEntry(QEvent *event)
Reimplemented Function
The WrappedEvent class inherits QEvent and holds a clone of an event associated with a QObject...
QStateMachine::Error error
#define QT_END_NAMESPACE
This macro expands to.
QState * parentState() const
Returns this state's parent state, or 0 if the state has no parent state.
static const QMetaObject staticMetaObject
QPair< QList< QAbstractAnimation * >, QList< QAbstractAnimation * > > initializeAnimation(QAbstractAnimation *abstractAnimation, const QPropertyAssignment &prop)
QStateMachine * machine() const
Returns the state machine that this state is part of, or 0 if the state is not part of a state machin...
void clear()
Removes all items from the hash.
int remove(const Key &key)
Removes all the items that have the key from the hash.
The QAbstractTransition class is the base class of transitions between QAbstractState objects...
virtual int qt_metacall(QMetaObject::Call, int, void **argv)
T * data() const
Returns the value of the pointer referenced by this object.
QList< QAbstractState * > targetStates
the target states of this transition
The QStateMachine class provides a hierarchical finite state machine.
#define it(className, varName)
void _q_animationFinished()
static bool stateEntryLessThan(QAbstractState *s1, QAbstractState *s2)
static const char qt_meta_stringdata_QSignalEventGenerator[]
void unregisterSignalTransition(QSignalTransition *transition)
void removeDefaultAnimation(QAbstractAnimation *animation)
Removes animation from the list of default animations.
void postInternalEvent(QEvent *e)
#define at(className, varName)
bool remove(const T &value)
const_iterator constEnd() const
The QByteArray class provides an array of bytes.
void setGlobalRestorePolicy(QStateMachine::RestorePolicy restorePolicy)
Sets the restore policy of the state machine to restorePolicy.
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
static bool isDescendantOf(const QAbstractState *s, const QAbstractState *other)
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
QPair< QObject *, QByteArray > RestorableId
int animationCount() const
Returns the number of animations managed by this group.
void postExternalEvent(QEvent *e)
int postDelayedEvent(QEvent *event, int delay)
Posts the given event for processing by this state machine, with the given delay in milliseconds...
QMutex delayedEventsMutex
StopProcessingReason stopProcessingReason
QVariant endValue() const
bool hasRestorable(QObject *object, const QByteArray &propertyName) const
Returns true if the variable with the given id has been registered for restoration.
static const QMetaObject staticMetaObject
This variable stores the meta-object for the class.
void start(QAbstractAnimation::DeletionPolicy policy=KeepWhenStopped)
Starts the animation.
QMultiHash< QAbstractState *, QAbstractAnimation * > defaultAnimationsForTarget
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QState::ChildMode childMode
long ASN1_INTEGER_get ASN1_INTEGER * a
int count(const T &t) const
Returns the number of occurrences of value in the list.
QHistoryState::HistoryType historyType
bool isInternalEventQueueEmpty()
QSet< QAbstractState * > configuration
The QString class provides a Unicode character string.
T * qobject_cast(QObject *object)
void setEndValue(const QVariant &value)
T take(const Key &key)
Removes the item with the key from the hash and returns the value associated with it...
The QHash class is a template class that provides a hash-table-based dictionary.
void onTransition(QEvent *)
This function is called when the transition is triggered.
The QObject class is the base class of all Qt objects.
bool startsWith(const QByteArray &a) const
Returns true if this byte array starts with byte array ba; otherwise returns false.
void start()
Starts this state machine.
QEvent::Type eventType
the type of event that this event transition is associated with
static const uint qt_meta_data_QSignalEventGenerator[]
~QStateMachine()
Destroys this state machine.
void cancelAllDelayedEvents()
void handleTransitionSignal(QObject *sender, int signalIndex, void **args)
QObject * targetObject
the target QObject for this animation.
void clearError()
Clears the error string and error code of the state machine.
void addStatesToEnter(QAbstractState *s, QState *root, QSet< QAbstractState *> &statesToEnter, QSet< QAbstractState *> &statesForDefaultEntry)
bool contains(const Key &key) const
Returns true if the hash contains an item with the key; otherwise returns false.
State state
state of the animation.
static QObjectPrivate * get(QObject *o)
static QEvent * cloneEvent(QEvent *e)
const T value(const Key &key) const
Returns the value associated with the key.
The QState class provides a general-purpose state for QStateMachine.
void stop()
Stops the animation.
void registerTransitions(QAbstractState *state)
void addState(QAbstractState *state)
Adds the given state to this state machine.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
void resize(int size)
Sets the size of the vector to size.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
void setParent(QObject *)
Makes the object a child of parent.
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
void processEvents(EventProcessingMode processingMode)
QHash< QObject *, QHash< QEvent::Type, int > > qobjectEvents
QList< QAbstractState * > targetStates() const
const QStateMachinePrivate::Handler qt_kernel_statemachine_handler
const Key & key() const
Returns the current item's key.
QList< QAbstractAnimation * > animations() const
Returns the list of animations associated with this transition, or an empty list if it has no animati...
QList< QPointer< QObject > > eventFilters
QAnimationGroup * group() const
If this animation is part of a QAnimationGroup, this function returns a pointer to the group; otherwi...
Q_CORE_EXPORT void qDebug(const char *,...)
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
void unregisterEventTransition(QEventTransition *transition)
QList< QAbstractState * > configuration
void goToState(QAbstractState *targetState)
Causes this state machine to unconditionally transition to the given targetState. ...
QAbstractState * defaultState
static QThread * currentThread()
Returns a pointer to a QThread which manages the currently executing thread.
void append(const T &t)
Inserts value at the end of the list.
void registerSignalTransition(QSignalTransition *transition)
static QHistoryStatePrivate * get(QHistoryState *q)
RestorePolicy
This enum specifies the restore policy type.
Error error() const
Returns the error code of the last error that occurred in the state machine.
bool eventFilter(QObject *watched, QEvent *event)
Reimplemented Function
#define QT_BEGIN_NAMESPACE
This macro expands to.
static QStateMachinePrivate * get(QStateMachine *q)
void setError(QStateMachine::Error error, QAbstractState *currentContext)
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
static bool isEmpty(const char *str)
The QEventTransition class provides a QObject-specific transition for Qt events.
virtual void beginSelectTransitions(QEvent *event)
This function is called when the state machine is about to select transitions based on the given even...
QHash< QAbstractAnimation *, QPropertyAssignment > propertyForAnimation
QSet< QAbstractState * > pendingErrorStates
The QAbstractState class is the base class of states of a QStateMachine.
The QSignalTransition class provides a transition based on a Qt signal.
bool contains(const T &value) const
T takeFirst()
Removes the first item in the list and returns it.
The QVariantAnimation class provides an abstract base class for animations.
QList< T > toList() const
void addDefaultAnimation(QAbstractAnimation *animation)
Adds a default animation to be considered for any transition.
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...
static QAbstractTransitionPrivate * get(QAbstractTransition *q)
The QFinalState class provides a final state.
bool eventTest(QEvent *)
This function is called to determine whether the given event should cause this transition to trigger...
QSet< QAbstractTransition * > selectTransitions(QEvent *event) const
virtual void endSelectTransitions(QEvent *event)
This function is called when the state machine has finished selecting transitions based on the given ...
bool isExternalEventQueueEmpty()
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
void onEntry(QEvent *event)
This function will call start() to start the state machine.
void prepend(const T &t)
Inserts value at the beginning of the list.
const T & at(int i) const
Returns the item at index position i in the list.
QHash< int, QEvent * > delayedEvents
bool isEmpty() const
Returns true if the hash contains no items; otherwise returns false.
const T & value() const
Returns the current item's value.
Q_CORE_EXPORT void qWarning(const char *,...)
bool isCompound(const QAbstractState *s) const
const_iterator insert(const T &value)
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
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.
~WrappedEvent()
Destroys this WrappedEvent.
QList< QAbstractTransition * > transitions() const
QAbstractState * initialState
the initial state of this state (one of its child states)
QState * rootState() const
QSignalEventGenerator * signalEventGenerator
void applyProperties(const QList< QAbstractTransition *> &transitionList, const QList< QAbstractState *> &exitedStates, const QList< QAbstractState *> &enteredStates)
QList< QEvent * > externalEventQueue
QState * sourceState() const
void onExit(QEvent *event)
Reimplemented Function
void clear()
Removes all items from the list.
GoToStateTransition(QAbstractState *target)
static QHistoryState * toHistoryState(QAbstractState *state)
The QAbstractAnimation class is the base of all animations.
void handleFilteredEvent(QObject *watched, QEvent *event)
QMutex internalEventMutex
void registerEventTransition(QEventTransition *transition)
void setTargetState(QAbstractState *target)
Sets the target state of this transition.
void stop()
Stops this state machine.
static QStatePrivate * get(QState *q)
void qSort(RandomAccessIterator start, RandomAccessIterator end)
const T & at(int i) const
Returns the item at index position i in the vector.
virtual void callOnTransition(QEvent *e)
static QAbstractStatePrivate * get(QAbstractState *q)
Q_CORE_EXPORT const QStateMachinePrivate::Handler * qcoreStateMachineHandler()
bool isPreempted(const QAbstractState *s, const QSet< QAbstractTransition *> &transitions) const
void unregisterRestorable(QObject *object, const QByteArray &propertyName)
void callOnExit(QEvent *e)
const char * constData() const
Returns a pointer to the data stored in the byte array.
QList< QAbstractAnimation * > defaultAnimations
QVariant restorableValue(QObject *object, const QByteArray &propertyName) const
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.
The QHistoryState class provides a means of returning to a previously active substate.
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the hash.
QHash< const QObject *, QVector< int > > connections
QState * sourceState
the source state (parent) of this transition
void onExit(QEvent *event)
This function will call stop() to stop the state machine and subsequently emit the stopped() signal...
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the hash...
QStateMachine(QObject *parent=0)
Constructs a new state machine with the given parent.
QSet< QAbstractState * > configuration() const
Returns the maximal consistent set of states (including parallel and final states) that this state ma...
Error
This enum type defines errors that can occur in the state machine at run time.
bool event(QEvent *e)
Reimplemented Function
#define Q_ASSERT_X(cond, where, what)
QHash< RestorableId, QVariant > registeredRestorables
iterator erase(iterator pos)
Removes the item associated with the iterator pos from the list, and returns an iterator to the next ...
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
QList< QEvent * > internalEventQueue
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
void executeTransitionContent(QEvent *event, const QList< QAbstractTransition *> &transitionList)
QMutex externalEventMutex
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
The QTimerEvent class contains parameters that describe a timer event.
QList< QHistoryState * > historyStates() const
EventPriority
This enum type specifies the priority of an event posted to the state machine using postEvent()...
static bool isFinal(const QAbstractState *s)
QEvent * dequeueInternalEvent()
void unregisterTransition(QAbstractTransition *transition)
static bool stateExitLessThan(QAbstractState *s1, QAbstractState *s2)
QState * findLCA(const QList< QAbstractState *> &states) const
const Key key(const T &value) const
Returns the first key mapped to value.
QList< T > values() const
Returns a list containing all the values in the hash, in an arbitrary order.
QList< QAbstractState * > childStates() const
QObject * parent() const
Returns a pointer to the parent object.
Q_OUTOFLINE_TEMPLATE QPair< T1, T2 > qMakePair(const T1 &x, const T2 &y)
#define st(var, type, card)
static QSignalTransitionPrivate * get(QSignalTransition *q)
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
T & last()
Returns a reference to the last item in the list.
int size() const
Returns the number of items in the list.
bool event(QEvent *e)
Reimplemented Function
QList< QPropertyAssignment > restorablesToPropertyList(const QHash< RestorableId, QVariant > &restorables) const
QString objectName() const
iterator begin()
Returns an STL-style iterator pointing to the first item in the hash.
bool isRunning() const
Returns whether this state machine is running.
const_iterator constBegin() const
QList< QAbstractState * > enterStates(QEvent *event, const QList< QAbstractTransition *> &enabledTransitions)
const QObjectList & children() const
Returns a list of child objects.
QHash< QAbstractAnimation *, QAbstractState * > stateForAnimation
QEvent * dequeueExternalEvent()
QVariant property(const char *name) const
Returns the value of the object's name property.
void setAnimated(bool enabled)
Sets whether animations are enabled for this state machine.
WrappedEvent(QObject *object, QEvent *event)
Constructs a new WrappedEvent object with the given object and event.
SignalEvent(QObject *sender, int signalIndex, const QList< QVariant > &arguments)
Constructs a new SignalEvent object with the given sender, signalIndex and arguments.
QScopedPointer< QObjectData > d_ptr
void emitPropertiesAssigned()
void microstep(QEvent *event, const QList< QAbstractTransition *> &transitionList)
void unregisterAllTransitions()
void postEvent(QEvent *event, EventPriority priority=NormalPriority)
Posts the given event of the given priority for processing by this state machine. ...
QByteArray propertyName
the target property name for this animation
bool cancelDelayedEvent(int id)
Cancels the delayed event identified by the given id.
QStateMachine::RestorePolicy globalRestorePolicy() const
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
QThread * thread() const
Returns the thread in which the object lives.
QSet< QAbstractAnimation * > resetAnimationEndValues
bool isInFinalState(QAbstractState *s) const
QAbstractState * initialState() const
The QAnimationGroup class is an abstract base class for groups of animations.
static QList< QState * > properAncestors(const QAbstractState *s, const QState *upperBound)
virtual void endMicrostep(QEvent *event)
This function is called when the state machine has finished doing a microstep.
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
~SignalEvent()
Destroys this SignalEvent.
static QState * toStandardState(QAbstractState *state)
QStateMachine * machine() const
Returns the state machine that this transition is part of, or 0 if the transition is not part of a st...
void addTransition(QAbstractTransition *transition)
Adds the given transition.
static bool isParallel(const QAbstractState *s)
QMultiHash< QAbstractState *, QAbstractAnimation * > defaultAnimationsForSource
bool isAtomic(const QAbstractState *s) const
The QEvent class is the base class of all event classes.
#define qPrintable(string)
Type type() const
Returns the event type.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
QList< QPropertyAssignment > propertyAssignments
int size() const
Returns the number of items in the vector.
QSet< QAbstractState * > pendingErrorStatesForDefaultEntry
QList< QAbstractAnimation * > defaultAnimations() const
Returns the list of default animations that will be considered for any transition.
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.
iterator erase(iterator it)
Removes the (key, value) pair associated with the iterator pos from the hash, and returns an iterator...
QList< QAbstractState * > exitStates(QEvent *event, const QList< QAbstractTransition *> &transitionList)
virtual void * qt_metacast(const char *)
bool isAnimated() const
Returns whether animations are enabled for this state machine.
The SignalEvent class represents a Qt signal event.
QString errorString() const
QByteArray & remove(int index, int len)
Removes len bytes from the array, starting at index position pos, and returns a reference to the arra...
void registerRestorable(QObject *object, const QByteArray &propertyName)
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
virtual void beginMicrostep(QEvent *event)
This function is called when the state machine is about to do a microstep.
static int indexOfDescendant(QState *s, QAbstractState *desc)
QAbstractState * errorState
static const Handler * handler
static QFinalState * toFinalState(QAbstractState *state)
The QList class is a template class that provides lists.
int signalIndex(const char *signalName) const
Returns the signal index used in the internal connectionLists vector.
void killTimer(int id)
Kills the timer with timer identifier, id.
QHash< QAbstractState *, QList< QAbstractAnimation * > > animationsForState
QAbstractState * errorState
the error state of this state