Backporting Qt4.6 support from PySide (Boost) to Shiboken, plus:
Implemented inject code for QState.addTransition - by Renato Araujo. QState test - by Renato Araujo.
This commit is contained in:
parent
41744e427a
commit
af9f990d61
6 changed files with 318 additions and 22 deletions
|
|
@ -42,6 +42,7 @@
|
|||
#include <QDebug>
|
||||
#include <limits>
|
||||
#include <typeresolver.h>
|
||||
#include <basewrapper.h>
|
||||
|
||||
#if QSLOT_CODE != 1 || QSIGNAL_CODE != 2
|
||||
#error QSLOT_CODE and/or QSIGNAL_CODE changed! change the hardcoded stuff to the correct value!
|
||||
|
|
@ -289,3 +290,24 @@ int PySide::SignalManager::qt_metacall(QObject* object, QMetaObject::Call call,
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool SignalManager::registerMetaMethod(QObject* source, const char* signature, QMetaMethod::MethodType type)
|
||||
{
|
||||
const QMetaObject* metaObject = source->metaObject();
|
||||
int methodIndex = metaObject->indexOfMethod(signature);
|
||||
// Create the dynamic signal is needed
|
||||
if (methodIndex == -1) {
|
||||
Shiboken::SbkBaseWrapper* self = (Shiboken::SbkBaseWrapper*) Shiboken::BindingManager::instance().retrieveWrapper(source);
|
||||
if (!self->containsCppWrapper) {
|
||||
qWarning() << "You can't add dynamic signals or slots on an object originated from C++.";
|
||||
return false;
|
||||
} else {
|
||||
PySide::DynamicQMetaObject* dynMetaObj = reinterpret_cast<PySide::DynamicQMetaObject*>(const_cast<QMetaObject*>(metaObject));
|
||||
if (type == QMetaMethod::Signal)
|
||||
dynMetaObj->addSignal(signature);
|
||||
else
|
||||
dynMetaObj->addSlot(signature);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include <Python.h>
|
||||
#include <Qt>
|
||||
#include <QStringList>
|
||||
#include <QMetaMethod>
|
||||
|
||||
class QObject;
|
||||
|
||||
|
|
@ -62,6 +63,9 @@ public:
|
|||
|
||||
void globalReceiverConnectNotify(int slotIndex);
|
||||
void globalReceiverDisconnectNotify(int slotIndex);
|
||||
|
||||
// Used to register a new signal/slot on QMetaobjc of source.
|
||||
static bool registerMetaMethod(QObject* source, const char* signature, QMetaMethod::MethodType type);
|
||||
private:
|
||||
struct SignalManagerPrivate;
|
||||
SignalManagerPrivate* m_d;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue