aboutsummaryrefslogtreecommitdiffstats
path: root/libpyside/dynamicqmetaobject.cpp
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-12-03 17:04:37 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:47:56 -0300
commit8fb60373627f5d9978df2b9f38d0180f5897477a (patch)
treedbc18e59d3fc6e82a535bac4a5a82e72c47a38d5 /libpyside/dynamicqmetaobject.cpp
parenta29f511f6ded054550feea317f089ac77b6b4994 (diff)
Set the object meta object at the declaration time, not instanciation time.
Diffstat (limited to 'libpyside/dynamicqmetaobject.cpp')
-rw-r--r--libpyside/dynamicqmetaobject.cpp58
1 files changed, 0 insertions, 58 deletions
diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp
index 345493286..1f6ff85a0 100644
--- a/libpyside/dynamicqmetaobject.cpp
+++ b/libpyside/dynamicqmetaobject.cpp
@@ -386,64 +386,6 @@ void DynamicQMetaObject::addProperty(const char* propertyName, PyObject* data)
m_d->updateMetaObject(this);
}
-
-DynamicQMetaObject* DynamicQMetaObject::createBasedOn(PyObject* pyObj, PyTypeObject* type, const QMetaObject* base)
-{
- PyObject* key;
- PyObject* value;
- Py_ssize_t pos = 0;
-
- QString className(type->tp_name);
- className = className.mid(className.lastIndexOf('.')+1);
- DynamicQMetaObject *mo = new PySide::DynamicQMetaObject(className.toAscii(), base);
-
- QList<PyObject*> properties;
-
- while (PyDict_Next(type->tp_dict, &pos, &key, &value)) {
-
- //Leave the properties to be register after signals because of notify object
- if (value->ob_type == &PySidePropertyType)
- properties.append(key);
-
- //Register signals
- if (value->ob_type == &PySideSignalType) {
- PyObject *attr = PyObject_GetAttr(pyObj, key);
- PySideSignalInstance *data = reinterpret_cast<PySideSignalInstance*>(attr);
- while(data) {
- int index = base->indexOfSignal(data->d->signature);
- if (index == -1)
- mo->addSignal(data->d->signature);
- data = reinterpret_cast<PySideSignalInstance*>(data->d->next);
- }
- }
-
- if (!PyFunction_Check(value))
- continue;
-
- //Register Slots
- if (PyObject_HasAttrString(value, PYSIDE_SLOT_LIST_ATTR)) {
- PyObject *signature_list = PyObject_GetAttrString(value, PYSIDE_SLOT_LIST_ATTR);
- for(Py_ssize_t i = 0, i_max = PyList_Size(signature_list); i < i_max; i++) {
- PyObject *signature = PyList_GET_ITEM(signature_list, i);
- QString sig(PyString_AsString(signature));
- //slot the slot type and signature
- QStringList slotInfo = sig.split(" ", QString::SkipEmptyParts);
- int index = base->indexOfSlot(qPrintable(slotInfo[1]));
- if (index == -1)
- mo->addSlot(slotInfo[1].toAscii(), slotInfo[0].toAscii());
- }
- }
- }
-
- //Register properties
- foreach(PyObject* key, properties) {
- PyObject* value = PyDict_GetItem(type->tp_dict, key);
- mo->addProperty(PyString_AsString(key), value);
- }
-
- return mo;
-}
-
void DynamicQMetaObject::removeSignal(uint index)
{
//Current Qt implementation does not support runtime remove signal