summaryrefslogtreecommitdiffstats
path: root/src/corelib/statemachine
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/statemachine')
-rw-r--r--src/corelib/statemachine/qstate.cpp11
-rw-r--r--src/corelib/statemachine/qstate.h14
2 files changed, 24 insertions, 1 deletions
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index b68dc88fb1..15f6e29fcb 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -339,6 +339,17 @@ void QState::addTransition(QAbstractTransition *transition)
}
/*!
+ \fn QState::addTransition(const QObject *sender, PointerToMemberFunction signal,
+ QAbstractState *target);
+ \since 5.5
+ \overload
+
+ Adds a transition associated with the given \a signal of the given \a sender
+ object, and returns the new QSignalTransition object. The transition has
+ this state as the source, and the given \a target as the target state.
+*/
+
+/*!
Adds a transition associated with the given \a signal of the given \a sender
object, and returns the new QSignalTransition object. The transition has
this state as the source, and the given \a target as the target state.
diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h
index a9fd04bf00..8a308cf38e 100644
--- a/src/corelib/statemachine/qstate.h
+++ b/src/corelib/statemachine/qstate.h
@@ -35,8 +35,8 @@
#define QSTATE_H
#include <QtCore/qabstractstate.h>
-
#include <QtCore/qlist.h>
+#include <QtCore/qmetaobject.h>
QT_BEGIN_NAMESPACE
@@ -74,6 +74,18 @@ public:
void addTransition(QAbstractTransition *transition);
QSignalTransition *addTransition(const QObject *sender, const char *signal, QAbstractState *target);
+#ifdef Q_QDOC
+ QSignalTransition *addTransition(const QObject *sender, PointerToMemberFunction signal,
+ QAbstractState *target);
+#else
+ template <typename Func>
+ QSignalTransition *addTransition(const typename QtPrivate::FunctionPointer<Func>::Object *obj,
+ Func signal, QAbstractState *target)
+ {
+ const QMetaMethod signalMetaMethod = QMetaMethod::fromSignal(signal);
+ return addTransition(obj, signalMetaMethod.methodSignature().constData(), target);
+ }
+#endif // Q_QDOC
QAbstractTransition *addTransition(QAbstractState *target);
void removeTransition(QAbstractTransition *transition);
QList<QAbstractTransition*> transitions() const;