summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libpyside/qsignal.cpp27
-rw-r--r--libpyside/qsignal.h1
2 files changed, 28 insertions, 0 deletions
diff --git a/libpyside/qsignal.cpp b/libpyside/qsignal.cpp
index f3ecc4b..23ee7ff 100644
--- a/libpyside/qsignal.cpp
+++ b/libpyside/qsignal.cpp
@@ -608,6 +608,33 @@ bool signalConnect(PyObject* source, const char* signal, PyObject* callback)
return PyObject_CallObject(pyMethod, pyArgs);
}
+PyObject* signalNewFromMethod(PyObject* source, const QList<QMetaMethod>& methodList)
+{
+ PySideSignalInstanceData *root = 0;
+ PySideSignalInstanceData *previous = 0;
+ foreach(QMetaMethod m, methodList) {
+ PySideSignalInstanceData *item = PyObject_New(PySideSignalInstanceData, &PySideSignalInstanceType);
+ if (!root)
+ root = item;
+
+ if (previous)
+ previous->d->next = reinterpret_cast<PyObject*>(item);
+
+ item->d = new PySideSignalInstanceDataPrivate;
+ PySideSignalInstanceDataPrivate* selfPvt = item->d;
+ selfPvt->source = source;
+ const char* cppSignature = m.signature();
+ // separe SignalName
+ selfPvt->signalName = strdup(cppSignature);
+ char* endName = strchr(selfPvt->signalName, '(');
+ endName = '\0';
+ selfPvt->signature = strdup(cppSignature);
+ selfPvt->homonymousMethod = 0;
+ selfPvt->next = 0;
+ }
+ return reinterpret_cast<PyObject*>(root);
+}
+
PyObject* signalNew(const char* name, ...)
{
va_list listSignatures;
diff --git a/libpyside/qsignal.h b/libpyside/qsignal.h
index 9f17360..4bbf841 100644
--- a/libpyside/qsignal.h
+++ b/libpyside/qsignal.h
@@ -48,6 +48,7 @@ namespace PySide
{
PYSIDE_API PyObject* signalNew(const char* name, ...);
+PYSIDE_API PyObject* signalNewFromMethod(PyObject* source, const QList<QMetaMethod>& method);
PYSIDE_API void signalUpdateSource(PyObject* source);
PYSIDE_API void addSignalToWrapper(Shiboken::SbkBaseWrapperType* wrapperType, const char* signalName, PyObject* signal);
PYSIDE_API PyObject* getSignalSource(PySideSignalInstanceData* signal);