Adapt to API changes in libshiboken.

This commit is contained in:
Hugo Parente Lima 2010-11-23 14:37:16 -02:00
commit a8ae0680f2
21 changed files with 92 additions and 92 deletions

View file

@ -15,10 +15,10 @@ static Py_ssize_t SbkQByteArray_segcountproc(PyObject* self, Py_ssize_t* lenp)
static Py_ssize_t SbkQByteArray_readbufferproc(PyObject* self, Py_ssize_t segment, void** ptrptr) static Py_ssize_t SbkQByteArray_readbufferproc(PyObject* self, Py_ssize_t segment, void** ptrptr)
{ {
if (segment || !Shiboken::Wrapper::isValid(self)) if (segment || !Shiboken::Object::isValid(self))
return -1; return -1;
QByteArray* cppSelf = Converter<QByteArray*>::toCpp(self); QByteArray* cppSelf = Shiboken::Converter<QByteArray*>::toCpp(self);
*ptrptr = reinterpret_cast<void*>(cppSelf->data()); *ptrptr = reinterpret_cast<void*>(cppSelf->data());
return cppSelf->size(); return cppSelf->size();
} }

View file

@ -4,7 +4,7 @@ static char** QCoreApplicationArgValues;
int Sbk_QCoreApplication_Init(PyObject* self, PyObject* args, PyObject*) int Sbk_QCoreApplication_Init(PyObject* self, PyObject* args, PyObject*)
{ {
if (Shiboken::Wrapper::isUserType(self) && !Shiboken::BaseType::canCallConstructor(self->ob_type, Shiboken::SbkType<QApplication >())) if (Shiboken::Object::isUserType(self) && !Shiboken::ObjectType::canCallConstructor(self->ob_type, Shiboken::SbkType<QApplication >()))
return -1; return -1;
@ -26,13 +26,13 @@ int Sbk_QCoreApplication_Init(PyObject* self, PyObject* args, PyObject*)
SbkObject* sbkSelf = reinterpret_cast<SbkObject*>(self); SbkObject* sbkSelf = reinterpret_cast<SbkObject*>(self);
QCoreApplicationWrapper* cptr = new QCoreApplicationWrapper(QCoreApplicationArgCount, QCoreApplicationArgValues); QCoreApplicationWrapper* cptr = new QCoreApplicationWrapper(QCoreApplicationArgCount, QCoreApplicationArgValues);
Shiboken::Wrapper::setCppPointer(sbkSelf, Shiboken::Object::setCppPointer(sbkSelf,
Shiboken::SbkType<QCoreApplication>(), Shiboken::SbkType<QCoreApplication>(),
cptr); cptr);
Shiboken::Wrapper::setValidCpp(sbkSelf, true); Shiboken::Object::setValidCpp(sbkSelf, true);
Shiboken::Wrapper::setHasCppWrapper(sbkSelf, true); Shiboken::Object::setHasCppWrapper(sbkSelf, true);
Shiboken::Wrapper::releaseOwnership(sbkSelf); Shiboken::Object::releaseOwnership(sbkSelf);
Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr); Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr);
PySide::Signal::updateSourceObject(self); PySide::Signal::updateSourceObject(self);

View file

@ -3,11 +3,11 @@ static bool getReceiver(PyObject* callback, QObject** receiver, PyObject** self)
if (PyMethod_Check(callback)) { if (PyMethod_Check(callback)) {
*self = PyMethod_GET_SELF(callback); *self = PyMethod_GET_SELF(callback);
if (Shiboken::Converter<QObject*>::checkType(*self)) if (Shiboken::Converter<QObject*>::checkType(*self))
*receiver = Converter<QObject*>::toCpp(*self); *receiver = Shiboken::Converter<QObject*>::toCpp(*self);
} else if (PyCFunction_Check(callback)) { } else if (PyCFunction_Check(callback)) {
*self = PyCFunction_GET_SELF(callback); *self = PyCFunction_GET_SELF(callback);
if (*self && Shiboken::Converter<QObject*>::checkType(*self)) if (*self && Shiboken::Converter<QObject*>::checkType(*self))
*receiver = Converter<QObject*>::toCpp(*self); *receiver = Shiboken::Converter<QObject*>::toCpp(*self);
} else if (PyCallable_Check(callback)) { } else if (PyCallable_Check(callback)) {
// Ok, just a callable object // Ok, just a callable object
*receiver = 0; *receiver = 0;
@ -66,7 +66,7 @@ static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject
const char* slot = callbackSig.constData(); const char* slot = callbackSig.constData();
int slotIndex = metaObject->indexOfSlot(slot); int slotIndex = metaObject->indexOfSlot(slot);
if (slotIndex == -1) { if (slotIndex == -1) {
if (!usingGlobalReceiver && self && !Shiboken::Wrapper::hasCppWrapper((SbkObject*)self)) { if (!usingGlobalReceiver && self && !Shiboken::Object::hasCppWrapper((SbkObject*)self)) {
qWarning() << "You can't add dynamic slots on an object originated from C++."; qWarning() << "You can't add dynamic slots on an object originated from C++.";
return false; return false;
} }

View file

@ -16,13 +16,13 @@ struct Converter<QVariant>
static QByteArray resolveMetaType(PyTypeObject* type, int &typeId) static QByteArray resolveMetaType(PyTypeObject* type, int &typeId)
{ {
if (PyObject_TypeCheck(type, &SbkBaseType_Type)) { if (PyObject_TypeCheck(type, &SbkObjectType_Type)) {
SbkBaseType* sbkType = reinterpret_cast<SbkBaseType*>(type); SbkObjectType* sbkType = reinterpret_cast<SbkObjectType*>(type);
QByteArray typeName(Shiboken::BaseType::getOriginalName(sbkType)); QByteArray typeName(Shiboken::ObjectType::getOriginalName(sbkType));
bool valueType = !typeName.endsWith("*"); bool valueType = !typeName.endsWith("*");
// Do not convert user type of value // Do not convert user type of value
if (valueType && Shiboken::BaseType::isUserType(type)) if (valueType && Shiboken::ObjectType::isUserType(type))
return QByteArray(); return QByteArray();
int obTypeId = QMetaType::type(typeName); int obTypeId = QMetaType::type(typeName);
@ -86,8 +86,8 @@ struct Converter<QVariant>
return convertToVariantList(pyObj); return convertToVariantList(pyObj);
} else { } else {
// a class supported by QVariant? // a class supported by QVariant?
if (Shiboken::Wrapper::checkType(pyObj)) { if (Shiboken::Object::checkType(pyObj)) {
SbkBaseType* objType = reinterpret_cast<SbkBaseType*>(pyObj->ob_type); SbkObjectType* objType = reinterpret_cast<SbkObjectType*>(pyObj->ob_type);
int typeCode = 0; int typeCode = 0;
QByteArray typeName = resolveMetaType(reinterpret_cast<PyTypeObject*>(objType), typeCode); QByteArray typeName = resolveMetaType(reinterpret_cast<PyTypeObject*>(objType), typeCode);
if (typeCode) { if (typeCode) {

View file

@ -26,8 +26,8 @@ struct Converter<QVariant::Type>
else if (pyObj == reinterpret_cast<PyObject*>(&PyLong_Type)) else if (pyObj == reinterpret_cast<PyObject*>(&PyLong_Type))
typeName = "int"; // long is a UserType in QVariant. typeName = "int"; // long is a UserType in QVariant.
else if (PyType_Check(pyObj)) { else if (PyType_Check(pyObj)) {
if (pyObj->ob_type == &SbkBaseType_Type) if (pyObj->ob_type == &SbkObjectType_Type)
typeName = Shiboken::BaseType::getOriginalName(reinterpret_cast<SbkBaseType*>(pyObj)); typeName = Shiboken::ObjectType::getOriginalName(reinterpret_cast<SbkObjectType*>(pyObj));
else else
typeName = reinterpret_cast<PyTypeObject*>(pyObj)->tp_name; typeName = reinterpret_cast<PyTypeObject*>(pyObj)->tp_name;
} }

View file

@ -1931,7 +1931,7 @@
PyObject* pyTimer = Shiboken::SbkType&lt;QTimer>()->tp_new(Shiboken::SbkType&lt;QTimer>(), emptyTuple, 0); PyObject* pyTimer = Shiboken::SbkType&lt;QTimer>()->tp_new(Shiboken::SbkType&lt;QTimer>(), emptyTuple, 0);
Shiboken::SbkType&lt;QTimer>()->tp_init(pyTimer, emptyTuple, 0); Shiboken::SbkType&lt;QTimer>()->tp_init(pyTimer, emptyTuple, 0);
QTimer* timer = Converter&lt;QTimer*>::toCpp(pyTimer); QTimer* timer = %CONVERTTOCPP[QTimer*](pyTimer);
Shiboken::AutoDecRef result( Shiboken::AutoDecRef result(
PyObject_CallMethod(pyTimer, PyObject_CallMethod(pyTimer,
const_cast&lt;char*>("connect"), const_cast&lt;char*>("connect"),
@ -1941,7 +1941,7 @@
%PYARG_2, %PYARG_2,
%3) %3)
); );
Shiboken::Wrapper::invalidate((SbkObject*)pyTimer); Shiboken::Object::invalidate((SbkObject*)pyTimer);
timer->setSingleShot(true); timer->setSingleShot(true);
timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater())); timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater()));
timer->start(%1); timer->start(%1);
@ -1953,7 +1953,7 @@
Shiboken::AutoDecRef emptyTuple(PyTuple_New(0)); Shiboken::AutoDecRef emptyTuple(PyTuple_New(0));
PyObject *pyTimer = Shiboken::SbkType&lt;QTimer>()->tp_new(Shiboken::SbkType&lt;QTimer>(), emptyTuple, 0); PyObject *pyTimer = Shiboken::SbkType&lt;QTimer>()->tp_new(Shiboken::SbkType&lt;QTimer>(), emptyTuple, 0);
Shiboken::SbkType&lt;QTimer>()->tp_init(pyTimer, emptyTuple, 0); Shiboken::SbkType&lt;QTimer>()->tp_init(pyTimer, emptyTuple, 0);
QTimer* timer = Converter&lt;QTimer*>::toCpp(pyTimer); QTimer* timer = %CONVERTTOCPP[QTimer*](pyTimer);
timer->setSingleShot(true); timer->setSingleShot(true);
timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater())); timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater()));
@ -1979,7 +1979,7 @@
pyargs[1]) pyargs[1])
); );
} }
Shiboken::Wrapper::invalidate((SbkObject*)pyTimer); Shiboken::Object::invalidate((SbkObject*)pyTimer);
timer->start(%1); timer->start(%1);
</inject-code> </inject-code>
</add-function> </add-function>
@ -2567,7 +2567,7 @@
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
for(int counter = 0; counter &lt; %CPPSELF.animationCount(); ++counter ) { for(int counter = 0; counter &lt; %CPPSELF.animationCount(); ++counter ) {
PyObject* obj = %CONVERTTOPYTHON[QAbstractAnimation*](%CPPSELF.animationAt(counter)); PyObject* obj = %CONVERTTOPYTHON[QAbstractAnimation*](%CPPSELF.animationAt(counter));
Shiboken::Wrapper::setParent(NULL, obj); Shiboken::Object::setParent(NULL, obj);
Py_DECREF(obj); Py_DECREF(obj);
} }
%CPPSELF.clear(); %CPPSELF.clear();
@ -2721,7 +2721,7 @@
%PYARG_0 = PySet_New(0); %PYARG_0 = PySet_New(0);
foreach(QAbstractState* abs_state, %CPPSELF.configuration()) { foreach(QAbstractState* abs_state, %CPPSELF.configuration()) {
Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractState*](abs_state)); Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractState*](abs_state));
Shiboken::Wrapper::setParent(self, obj); Shiboken::Object::setParent(self, obj);
PySet_Add(%PYARG_0, obj); PySet_Add(%PYARG_0, obj);
} }
</inject-code> </inject-code>
@ -2732,7 +2732,7 @@
%PYARG_0 = PyList_New(0); %PYARG_0 = PyList_New(0);
foreach(QAbstractAnimation* abs_anim, %CPPSELF.defaultAnimations()) { foreach(QAbstractAnimation* abs_anim, %CPPSELF.defaultAnimations()) {
Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractAnimation*](abs_anim)); Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractAnimation*](abs_anim));
Shiboken::Wrapper::setParent(self, obj); Shiboken::Object::setParent(self, obj);
PyList_Append(%PYARG_0, obj); PyList_Append(%PYARG_0, obj);
} }
</inject-code> </inject-code>

View file

@ -7,7 +7,7 @@ static const char QAPP_MACRO[] = "qApp";
int Sbk_QApplication_Init(PyObject* self, PyObject* args, PyObject*) int Sbk_QApplication_Init(PyObject* self, PyObject* args, PyObject*)
{ {
if (Shiboken::Wrapper::isUserType(self) && !Shiboken::BaseType::canCallConstructor(self->ob_type, Shiboken::SbkType<QApplication>())) if (Shiboken::Object::isUserType(self) && !Shiboken::ObjectType::canCallConstructor(self->ob_type, Shiboken::SbkType<QApplication>()))
return -1; return -1;
if (QApplication::instance()) { if (QApplication::instance()) {
@ -28,12 +28,12 @@ int Sbk_QApplication_Init(PyObject* self, PyObject* args, PyObject*)
SbkObject* sbkSelf = reinterpret_cast<SbkObject*>(self); SbkObject* sbkSelf = reinterpret_cast<SbkObject*>(self);
QApplicationWrapper* cptr = new QApplicationWrapper(QApplicationArgCount, QApplicationArgValues); QApplicationWrapper* cptr = new QApplicationWrapper(QApplicationArgCount, QApplicationArgValues);
Shiboken::Wrapper::setCppPointer(sbkSelf, Shiboken::Object::setCppPointer(sbkSelf,
Shiboken::SbkType<QApplication>(), Shiboken::SbkType<QApplication>(),
cptr); cptr);
Shiboken::Wrapper::setValidCpp(sbkSelf, true); Shiboken::Object::setValidCpp(sbkSelf, true);
Shiboken::Wrapper::setHasCppWrapper(sbkSelf, true); Shiboken::Object::setHasCppWrapper(sbkSelf, true);
Shiboken::Wrapper::releaseOwnership(sbkSelf); Shiboken::Object::releaseOwnership(sbkSelf);
Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr); Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr);
PySide::Signal::updateSourceObject(self); PySide::Signal::updateSourceObject(self);
cptr->metaObject(); cptr->metaObject();

View file

@ -18,11 +18,11 @@ inline void addLayoutOwnership(QLayout* layout, QWidget* widget)
//keep the reference while the layout is orphan //keep the reference while the layout is orphan
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(layout)); Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(layout));
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(widget)); Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(widget));
Shiboken::Wrapper::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true); Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
} else { } else {
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(parent)); Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(parent));
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(widget)); Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(widget));
Shiboken::Wrapper::setParent(pyParent, pyChild); Shiboken::Object::setParent(pyParent, pyChild);
} }
} }
@ -34,7 +34,7 @@ inline void addLayoutOwnership(QLayout* layout, QLayout* other)
//keep the reference while the layout is orphan //keep the reference while the layout is orphan
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QLayout*>::toPython(layout)); Shiboken::AutoDecRef pyParent(Shiboken::Converter<QLayout*>::toPython(layout));
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayout*>::toPython(other)); Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayout*>::toPython(other));
Shiboken::Wrapper::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true); Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
return; return;
} }
@ -48,7 +48,7 @@ inline void addLayoutOwnership(QLayout* layout, QLayout* other)
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QLayout*>::toPython(layout)); Shiboken::AutoDecRef pyParent(Shiboken::Converter<QLayout*>::toPython(layout));
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayout*>::toPython(other)); Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayout*>::toPython(other));
Shiboken::Wrapper::setParent(pyParent, pyChild); Shiboken::Object::setParent(pyParent, pyChild);
} }
@ -65,7 +65,7 @@ inline void addLayoutOwnership(QLayout* layout, QLayoutItem* item)
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QLayout*>::toPython(layout)); Shiboken::AutoDecRef pyParent(Shiboken::Converter<QLayout*>::toPython(layout));
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayoutItem*>::toPython(item)); Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayoutItem*>::toPython(item));
Shiboken::Wrapper::setParent(pyParent, pyChild); Shiboken::Object::setParent(pyParent, pyChild);
} }
#endif #endif

View file

@ -22,7 +22,7 @@ static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout)
QWidget* pw = w->parentWidget(); QWidget* pw = w->parentWidget();
if (pw != parent) { if (pw != parent) {
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(w)); Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(w));
Shiboken::Wrapper::setParent(pyParent, pyChild); Shiboken::Object::setParent(pyParent, pyChild);
} }
} else { } else {
QLayout* l = item->layout(); QLayout* l = item->layout();
@ -32,9 +32,9 @@ static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout)
} }
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayout*>::toPython(layout)); Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayout*>::toPython(layout));
Shiboken::Wrapper::setParent(pyParent, pyChild); Shiboken::Object::setParent(pyParent, pyChild);
//remove previous references //remove previous references
Shiboken::Wrapper::keepReference(reinterpret_cast<SbkObject*>(pyChild.object()), qPrintable(retrieveObjectName(pyChild)), Py_None); Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(pyChild.object()), qPrintable(retrieveObjectName(pyChild)), Py_None);
} }
static inline void qwidgetSetLayout(QWidget *self, QLayout *layout) static inline void qwidgetSetLayout(QWidget *self, QLayout *layout)
@ -47,7 +47,7 @@ static inline void qwidgetSetLayout(QWidget *self, QLayout *layout)
if (oldParent->isWidgetType()) { if (oldParent->isWidgetType()) {
// remove old parent policy // remove old parent policy
Shiboken::AutoDecRef pyLayout(Shiboken::Converter<QLayout*>::toPython(layout)); Shiboken::AutoDecRef pyLayout(Shiboken::Converter<QLayout*>::toPython(layout));
Shiboken::Wrapper::setParent(Py_None, pyLayout); Shiboken::Object::setParent(Py_None, pyLayout);
} else { } else {
PyErr_Format(PyExc_RuntimeError, "QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", when the QLayout already has a parent", PyErr_Format(PyExc_RuntimeError, "QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", when the QLayout already has a parent",
qPrintable(layout->objectName()), self->metaObject()->className(), qPrintable(self->objectName())); qPrintable(layout->objectName()), self->metaObject()->className(), qPrintable(self->objectName()));

View file

@ -8,15 +8,15 @@ inline bool Converter<QPixmap>::isConvertible(PyObject* pyobj)
{ {
if (ValueTypeConverter<QPixmap>::isConvertible(pyobj)) if (ValueTypeConverter<QPixmap>::isConvertible(pyobj))
return true; return true;
SbkBaseType* shiboType = reinterpret_cast<SbkBaseType*>(SbkType<QPixmap>()); SbkObjectType* shiboType = reinterpret_cast<SbkObjectType*>(SbkType<QPixmap>());
bool isVariant = Converter<QVariant>::checkType(pyobj); bool isVariant = Shiboken::Converter<QVariant>::checkType(pyobj);
if (isVariant) { if (isVariant) {
QVariant var(Converter<QVariant>::toCpp(pyobj)); QVariant var(Shiboken::Converter<QVariant>::toCpp(pyobj));
return var.type() == QVariant::Pixmap; return var.type() == QVariant::Pixmap;
} else if (Converter<QSize>::checkType(pyobj) || Converter<QString>::checkType(pyobj)) { } else if (Shiboken::Converter<QSize>::checkType(pyobj) || Shiboken::Converter<QString>::checkType(pyobj)) {
return true; return true;
} else { } else {
return Shiboken::BaseType::isExternalConvertible(shiboType, pyobj); return Shiboken::ObjectType::isExternalConvertible(shiboType, pyobj);
} }
return false; return false;
@ -24,7 +24,7 @@ inline bool Converter<QPixmap>::isConvertible(PyObject* pyobj)
inline QPixmap Converter<QPixmap>::toCpp(PyObject* pyobj) inline QPixmap Converter<QPixmap>::toCpp(PyObject* pyobj)
{ {
SbkBaseType* shiboType = reinterpret_cast<SbkBaseType*>(SbkType<QPixmap>()); SbkObjectType* shiboType = reinterpret_cast<SbkObjectType*>(SbkType<QPixmap>());
bool isVariant = Converter<QVariant>::checkType(pyobj); bool isVariant = Converter<QVariant>::checkType(pyobj);
if (isVariant) { if (isVariant) {
QVariant var(Converter<QVariant>::toCpp(pyobj)); QVariant var(Converter<QVariant>::toCpp(pyobj));
@ -33,8 +33,8 @@ inline QPixmap Converter<QPixmap>::toCpp(PyObject* pyobj)
return QPixmap(Shiboken::Converter<QSize >::toCpp(pyobj)); return QPixmap(Shiboken::Converter<QSize >::toCpp(pyobj));
} else if (Converter<QString>::checkType(pyobj)) { } else if (Converter<QString>::checkType(pyobj)) {
return QPixmap(Shiboken::Converter<QString >::toCpp(pyobj)); return QPixmap(Shiboken::Converter<QString >::toCpp(pyobj));
} else if (Shiboken::BaseType::isExternalConvertible(shiboType, pyobj) && Shiboken::BaseType::hasExternalCppConversions(shiboType)) { } else if (Shiboken::ObjectType::isExternalConvertible(shiboType, pyobj) && Shiboken::ObjectType::hasExternalCppConversions(shiboType)) {
QPixmap* cptr = reinterpret_cast<QPixmap*>(Shiboken::BaseType::callExternalCppConversion(shiboType, pyobj)); QPixmap* cptr = reinterpret_cast<QPixmap*>(Shiboken::ObjectType::callExternalCppConversion(shiboType, pyobj));
std::auto_ptr<QPixmap> cptr_auto_ptr(cptr); std::auto_ptr<QPixmap> cptr_auto_ptr(cptr);
return *cptr; return *cptr;
} }

View file

@ -526,7 +526,7 @@
<add-function signature="value()" return-type="QTreeWidgetItem*"> <add-function signature="value()" return-type="QTreeWidgetItem*">
<inject-code> <inject-code>
%PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItem*](%CPPSELF.operator*()); %PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItem*](%CPPSELF.operator*());
Shiboken::Wrapper::releaseOwnership(%PYARG_0); Shiboken::Object::releaseOwnership(%PYARG_0);
</inject-code> </inject-code>
</add-function> </add-function>
<enum-type name="IteratorFlag" flags="QTreeWidgetItemIterator::IteratorFlags"/> <enum-type name="IteratorFlag" flags="QTreeWidgetItemIterator::IteratorFlags"/>
@ -1621,7 +1621,7 @@
<reference-count action="add"/> <reference-count action="add"/>
</modify-argument> </modify-argument>
<inject-code> <inject-code>
Shiboken::Wrapper::releaseOwnership(%PYARG_2); Shiboken::Object::releaseOwnership(%PYARG_2);
</inject-code> </inject-code>
</modify-function> </modify-function>
<modify-function signature="setDefaultFactory(QItemEditorFactory *)"> <modify-function signature="setDefaultFactory(QItemEditorFactory *)">
@ -1955,7 +1955,7 @@
<inject-code class="target" position="end"> <inject-code class="target" position="end">
Shiboken::AutoDecRef result(PyObject_CallMethod(%PYSELF, "connect", "OsO", %PYSELF, SIGNAL(activated()), %PYARG_3)); Shiboken::AutoDecRef result(PyObject_CallMethod(%PYSELF, "connect", "OsO", %PYSELF, SIGNAL(activated()), %PYARG_3));
if (!result.isNull()) if (!result.isNull())
Shiboken::Wrapper::setParent(%PYARG_2, %PYSELF); Shiboken::Object::setParent(%PYARG_2, %PYSELF);
</inject-code> </inject-code>
</add-function> </add-function>
</object-type> </object-type>
@ -2018,7 +2018,7 @@
QStandardItem* _i = %CPPSELF->child(%1, %2); QStandardItem* _i = %CPPSELF->child(%1, %2);
if (_i) { if (_i) {
PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i);
Shiboken::Wrapper::setParent(0, _pyI); Shiboken::Object::setParent(0, _pyI);
} }
</inject-code> </inject-code>
<modify-argument index="3"> <modify-argument index="3">
@ -2031,7 +2031,7 @@
QStandardItem* _i = %CPPSELF->child(%1); QStandardItem* _i = %CPPSELF->child(%1);
if (_i) { if (_i) {
PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i);
Shiboken::Wrapper::setParent(0, _pyI); Shiboken::Object::setParent(0, _pyI);
} }
</inject-code> </inject-code>
<modify-argument index="2"> <modify-argument index="2">
@ -2170,7 +2170,7 @@
QWidget *_widget = %CPPSELF.widget(%1); QWidget *_widget = %CPPSELF.widget(%1);
if (_widget) { if (_widget) {
Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](_widget)); Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](_widget));
Shiboken::Wrapper::setParent(0, pyWidget); Shiboken::Object::setParent(0, pyWidget);
} }
</inject-code> </inject-code>
</modify-function> </modify-function>
@ -3317,7 +3317,7 @@
<modify-function signature="setStyle(QStyle*)"> <modify-function signature="setStyle(QStyle*)">
<inject-code class="target" position="end"> <inject-code class="target" position="end">
Shiboken::Wrapper::keepReference(reinterpret_cast&lt;SbkObject*&gt;(%PYSELF), "__style__", %PYARG_1); Shiboken::Object::keepReference(reinterpret_cast&lt;SbkObject*&gt;(%PYSELF), "__style__", %PYARG_1);
</inject-code> </inject-code>
</modify-function> </modify-function>
<modify-function signature="style()const"> <modify-function signature="style()const">
@ -3328,10 +3328,10 @@
QStyle *appStyle = qApp->style(); QStyle *appStyle = qApp->style();
if (appStyle == myStyle) { if (appStyle == myStyle) {
Shiboken::AutoDecRef pyApp(%CONVERTTOPYTHON[QApplication*](qApp)); Shiboken::AutoDecRef pyApp(%CONVERTTOPYTHON[QApplication*](qApp));
Shiboken::Wrapper::setParent(pyApp, %PYARG_0); Shiboken::Object::setParent(pyApp, %PYARG_0);
Shiboken::Wrapper::releaseOwnership(%PYARG_0); Shiboken::Object::releaseOwnership(%PYARG_0);
} else { } else {
Shiboken::Wrapper::keepReference(reinterpret_cast&lt;SbkObject*&gt;(%PYSELF), "__style__", %PYARG_0); Shiboken::Object::keepReference(reinterpret_cast&lt;SbkObject*&gt;(%PYSELF), "__style__", %PYARG_0);
} }
} }
</inject-code> </inject-code>
@ -3586,7 +3586,7 @@
QWidget* tab = %CPPSELF.widget(%1); QWidget* tab = %CPPSELF.widget(%1);
if (tab) { if (tab) {
Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](tab)); Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](tab));
Shiboken::Wrapper::setParent(0, pyWidget); Shiboken::Object::setParent(0, pyWidget);
%CPPSELF.%FUNCTION_NAME(%1); %CPPSELF.%FUNCTION_NAME(%1);
} }
</inject-code> </inject-code>
@ -3595,7 +3595,7 @@
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
for (int i=0; i &lt; %CPPSELF.count(); i++) { for (int i=0; i &lt; %CPPSELF.count(); i++) {
Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](%CPPSELF.widget(i))); Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](%CPPSELF.widget(i)));
Shiboken::Wrapper::setParent(0, pyWidget); Shiboken::Object::setParent(0, pyWidget);
} }
%CPPSELF.%FUNCTION_NAME(); %CPPSELF.%FUNCTION_NAME();
</inject-code> </inject-code>
@ -3853,7 +3853,7 @@
QStandardItem* _i = %CPPSELF->item(%1, %2); QStandardItem* _i = %CPPSELF->item(%1, %2);
if (_i) { if (_i) {
PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i);
Shiboken::Wrapper::setParent(0, _pyI); Shiboken::Object::setParent(0, _pyI);
} }
</inject-code> </inject-code>
<modify-argument index="3"> <modify-argument index="3">
@ -3866,7 +3866,7 @@
QStandardItem* _i = %CPPSELF->item(%1); QStandardItem* _i = %CPPSELF->item(%1);
if (_i) { if (_i) {
PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i);
Shiboken::Wrapper::setParent(0, _pyI); Shiboken::Object::setParent(0, _pyI);
} }
</inject-code> </inject-code>
<modify-argument index="2"> <modify-argument index="2">
@ -3885,7 +3885,7 @@
QStandardItem* _i = %CPPSELF->verticalHeaderItem(%1); QStandardItem* _i = %CPPSELF->verticalHeaderItem(%1);
if (_i) { if (_i) {
PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i);
Shiboken::Wrapper::setParent(0, _pyI); Shiboken::Object::setParent(0, _pyI);
} }
</inject-code> </inject-code>
<modify-argument index="2"> <modify-argument index="2">
@ -3935,7 +3935,7 @@
QList&lt;QStandardItem *&gt; ri = %CPPSELF.takeRow(0); QList&lt;QStandardItem *&gt; ri = %CPPSELF.takeRow(0);
PyObject *pyResult = %CONVERTTOPYTHON[QList&lt;QStandardItem * &gt;](ri); PyObject *pyResult = %CONVERTTOPYTHON[QList&lt;QStandardItem * &gt;](ri);
Shiboken::Wrapper::setParent(Py_None, pyResult); Shiboken::Object::setParent(Py_None, pyResult);
Py_XDECREF(pyResult); Py_XDECREF(pyResult);
} }
</inject-code> </inject-code>
@ -4554,7 +4554,7 @@
<!-- ownership control transfer to qApp --> <!-- ownership control transfer to qApp -->
<modify-function signature="setStyle(QStyle*)"> <modify-function signature="setStyle(QStyle*)">
<inject-code class="target" position="end"> <inject-code class="target" position="end">
Shiboken::Wrapper::setParent(%CONVERTTOPYTHON[QApplication*](qApp), %PYARG_1); Shiboken::Object::setParent(%CONVERTTOPYTHON[QApplication*](qApp), %PYARG_1);
</inject-code> </inject-code>
</modify-function> </modify-function>
<modify-function signature="style()"> <modify-function signature="style()">

View file

@ -20,7 +20,7 @@ _populate_parent(PyObject* pyParent, QObject *parent)
if (!has_attr) if (!has_attr)
PyObject_SetAttrString(pyParent, qPrintable(name), pyChild); PyObject_SetAttrString(pyParent, qPrintable(name), pyChild);
Shiboken::Wrapper::setParent(pyParent, pyChild); Shiboken::Object::setParent(pyParent, pyChild);
_populate_parent(pyChild, qobject_cast<QObject*>(child)); _populate_parent(pyChild, qobject_cast<QObject*>(child));
} }
} }

View file

@ -40,8 +40,8 @@
</modify-argument> </modify-argument>
<inject-code position="end"> <inject-code position="end">
SbkObject* _pyReturn = reinterpret_cast&lt;SbkObject*&gt;(%PYARG_0); SbkObject* _pyReturn = reinterpret_cast&lt;SbkObject*&gt;(%PYARG_0);
if (!Shiboken::Wrapper::hasParentInfo(_pyReturn)) if (!Shiboken::Object::hasParentInfo(_pyReturn))
Shiboken::Wrapper::setParent(%PYSELF, %PYARG_0); Shiboken::Object::setParent(%PYSELF, %PYARG_0);
</inject-code> </inject-code>
</modify-function> </modify-function>
<modify-function signature="print(QPrinter*)const" rename="print_" /> <modify-function signature="print(QPrinter*)const" rename="print_" />

View file

@ -290,8 +290,8 @@
<object-type name="QXmlLexicalHandler"/> <object-type name="QXmlLexicalHandler"/>
<template name="QXmlEntityResolver_resolveEntity_return_conversion_native"> <template name="QXmlEntityResolver_resolveEntity_return_conversion_native">
AutoDecRef _py_ok_(PySequence_GetItem(%PYARG_0, 0)); Shiboken::AutoDecRef _py_ok_(PySequence_GetItem(%PYARG_0, 0));
AutoDecRef _py_ret_(PySequence_GetItem(%PYARG_0, 1)); Shiboken::AutoDecRef _py_ret_(PySequence_GetItem(%PYARG_0, 1));
%RETURN_TYPE %out = %CONVERTTOCPP[%RETURN_TYPE](_py_ok_); %RETURN_TYPE %out = %CONVERTTOCPP[%RETURN_TYPE](_py_ok_);
%3 = %CONVERTTOCPP[QXmlInputSource*](_py_ret_); %3 = %CONVERTTOCPP[QXmlInputSource*](_py_ret_);
</template> </template>

View file

@ -23,9 +23,9 @@
$CHILD_TYPE* oldChild = %CPPSELF.$FUNCTION_GET_OLD(); $CHILD_TYPE* oldChild = %CPPSELF.$FUNCTION_GET_OLD();
if (oldChild) { if (oldChild) {
Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[$CHILD_TYPE*](oldChild)); Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[$CHILD_TYPE*](oldChild));
Shiboken::Wrapper::setParent(NULL, pyChild); Shiboken::Object::setParent(NULL, pyChild);
} }
Shiboken::Wrapper::setParent(%PYSELF, $PYARG); Shiboken::Object::setParent(%PYSELF, $PYARG);
</template> </template>
<!-- Templates to fix bool* parameters --> <!-- Templates to fix bool* parameters -->
@ -155,8 +155,8 @@
</template> </template>
<template name="fix_virtual_method_return_value_and_bool*"> <template name="fix_virtual_method_return_value_and_bool*">
AutoDecRef _py_ret_(PySequence_GetItem(%PYARG_0, 0)); Shiboken::AutoDecRef _py_ret_(PySequence_GetItem(%PYARG_0, 0));
AutoDecRef _py_ok_(PySequence_GetItem(%PYARG_0, 1)); Shiboken::AutoDecRef _py_ok_(PySequence_GetItem(%PYARG_0, 1));
%RETURN_TYPE %out = %CONVERTTOCPP[%RETURN_TYPE](_py_ret_); %RETURN_TYPE %out = %CONVERTTOCPP[%RETURN_TYPE](_py_ret_);
*%2 = %CONVERTTOCPP[bool](_py_ok_); *%2 = %CONVERTTOCPP[bool](_py_ok_);
</template> </template>
@ -183,8 +183,8 @@
</template> </template>
<template name="set_qapp_parent_for_orphan"> <template name="set_qapp_parent_for_orphan">
SbkObject* _pySelf = reinterpret_cast&lt;SbkObject*&gt;(%PYARG_0); SbkObject* _pySelf = reinterpret_cast&lt;SbkObject*&gt;(%PYARG_0);
if (!Shiboken::Wrapper::hasParentInfo(_pySelf)) if (!Shiboken::Object::hasParentInfo(_pySelf))
Shiboken::Wrapper::setParent(%CONVERTTOPYTHON[QApplication*](qApp), %PYARG_0); Shiboken::Object::setParent(%CONVERTTOPYTHON[QApplication*](qApp), %PYARG_0);
</template> </template>
<!-- templates for __reduce__ --> <!-- templates for __reduce__ -->
<template name="reduce_code"> <template name="reduce_code">

View file

@ -116,8 +116,8 @@ void destroyQCoreApplication()
foreach (SbkObject* pyObj, bm.getAllPyObjects()) { foreach (SbkObject* pyObj, bm.getAllPyObjects()) {
if (pyObj != pyQApp && PyObject_TypeCheck(pyObj, pyQObjectType)) { if (pyObj != pyQApp && PyObject_TypeCheck(pyObj, pyQObjectType)) {
if (Shiboken::Wrapper::hasOwnership(pyObj)) if (Shiboken::Object::hasOwnership(pyObj))
Shiboken::callCppDestructor<QObject>(Shiboken::Wrapper::cppPointer(pyObj, Shiboken::SbkType<QObject*>())); Shiboken::callCppDestructor<QObject>(Shiboken::Object::cppPointer(pyObj, Shiboken::SbkType<QObject*>()));
} }
} }
delete app; delete app;

View file

@ -40,7 +40,7 @@ struct QtDictConverter
if (PyObject_TypeCheck(pyObj, Shiboken::SbkType<QtDict>())) if (PyObject_TypeCheck(pyObj, Shiboken::SbkType<QtDict>()))
return true; return true;
if ((Shiboken::SbkType<QtDict>() && Shiboken::Wrapper::checkType(pyObj)) || !PyDict_Check(pyObj)) if ((Shiboken::SbkType<QtDict>() && Shiboken::Object::checkType(pyObj)) || !PyDict_Check(pyObj))
return false; return false;
PyObject* key; PyObject* key;
@ -73,7 +73,7 @@ struct QtDictConverter
static inline QtDict toCpp(PyObject* pyobj) static inline QtDict toCpp(PyObject* pyobj)
{ {
if (PyObject_TypeCheck(pyobj, Shiboken::SbkType<QtDict>())) if (PyObject_TypeCheck(pyobj, Shiboken::SbkType<QtDict>()))
return *reinterpret_cast<QtDict*>(Shiboken::Wrapper::cppPointer((SbkObject*)pyobj, Shiboken::SbkType<QtDict>())); return *reinterpret_cast<QtDict*>(Shiboken::Object::cppPointer((SbkObject*)pyobj, Shiboken::SbkType<QtDict>()));
QtDict result; QtDict result;
@ -100,7 +100,7 @@ struct QtMultiMapConverter
if (PyObject_TypeCheck(pyObj, Shiboken::SbkType<MultiMap>())) if (PyObject_TypeCheck(pyObj, Shiboken::SbkType<MultiMap>()))
return true; return true;
if ((Shiboken::SbkType<MultiMap>() && Shiboken::Wrapper::checkType(pyObj)) || !PyDict_Check(pyObj)) if ((Shiboken::SbkType<MultiMap>() && Shiboken::Object::checkType(pyObj)) || !PyDict_Check(pyObj))
return false; return false;
PyObject* key; PyObject* key;
@ -150,7 +150,7 @@ struct QtMultiMapConverter
static inline MultiMap toCpp(PyObject* pyObj) static inline MultiMap toCpp(PyObject* pyObj)
{ {
if (PyObject_TypeCheck(pyObj, Shiboken::SbkType<MultiMap>())) if (PyObject_TypeCheck(pyObj, Shiboken::SbkType<MultiMap>()))
return *reinterpret_cast<MultiMap*>(Shiboken::Wrapper::cppPointer((SbkObject*)pyObj, Shiboken::SbkType<MultiMap>())); return *reinterpret_cast<MultiMap*>(Shiboken::Object::cppPointer((SbkObject*)pyObj, Shiboken::SbkType<MultiMap>()));
MultiMap result; MultiMap result;
@ -176,7 +176,7 @@ struct QSequenceConverter
{ {
if (PyObject_TypeCheck(pyObj, Shiboken::SbkType<T>())) if (PyObject_TypeCheck(pyObj, Shiboken::SbkType<T>()))
return true; return true;
if ((Shiboken::SbkType<T>() && Shiboken::Wrapper::checkType(pyObj)) || !PySequence_Check(pyObj)) if ((Shiboken::SbkType<T>() && Shiboken::Object::checkType(pyObj)) || !PySequence_Check(pyObj))
return false; return false;
for (int i = 0, max = PySequence_Length(pyObj); i < max; ++i) { for (int i = 0, max = PySequence_Length(pyObj); i < max; ++i) {
Shiboken::AutoDecRef item(PySequence_GetItem(pyObj, i)); Shiboken::AutoDecRef item(PySequence_GetItem(pyObj, i));
@ -199,7 +199,7 @@ struct QSequenceConverter
static T toCpp(PyObject* pyobj) static T toCpp(PyObject* pyobj)
{ {
if (PyObject_TypeCheck(pyobj, Shiboken::SbkType<T>())) if (PyObject_TypeCheck(pyobj, Shiboken::SbkType<T>()))
return *reinterpret_cast<T*>(Shiboken::Wrapper::cppPointer((SbkObject*)pyobj, Shiboken::SbkType<T>())); return *reinterpret_cast<T*>(Shiboken::Object::cppPointer((SbkObject*)pyobj, Shiboken::SbkType<T>()));
Shiboken::AutoDecRef fastSequence(PySequence_Fast(pyobj, "Invalid sequence object")); Shiboken::AutoDecRef fastSequence(PySequence_Fast(pyobj, "Invalid sequence object"));
T result; T result;

View file

@ -493,9 +493,9 @@ char* getTypeName(PyObject* type)
{ {
if (PyType_Check(type)) { if (PyType_Check(type)) {
char *typeName = NULL; char *typeName = NULL;
if (type->ob_type == &SbkBaseType_Type) { if (type->ob_type == &SbkObjectType_Type) {
SbkBaseType* objType = reinterpret_cast<SbkBaseType*>(type); SbkObjectType* objType = reinterpret_cast<SbkObjectType*>(type);
typeName = strdup(Shiboken::BaseType::getOriginalName(objType)); typeName = strdup(Shiboken::ObjectType::getOriginalName(objType));
} else { } else {
// Translate python types to Qt names // Translate python types to Qt names
PyTypeObject *objType = reinterpret_cast<PyTypeObject*>(type); PyTypeObject *objType = reinterpret_cast<PyTypeObject*>(type);
@ -669,7 +669,7 @@ PyObject* buildQtCompatible(const char* signature)
return ret; return ret;
} }
void addSignalToWrapper(SbkBaseType* wrapperType, const char* signalName, PySideSignal* signal) void addSignalToWrapper(SbkObjectType* wrapperType, const char* signalName, PySideSignal* signal)
{ {
PyObject* typeDict = wrapperType->super.ht_type.tp_dict; PyObject* typeDict = wrapperType->super.ht_type.tp_dict;
PyObject* homonymousMethod; PyObject* homonymousMethod;

View file

@ -107,7 +107,7 @@ PYSIDE_API void updateSourceObject(PyObject* source);
* @param self The Signal object * @param self The Signal object
* @return Return the signal signature * @return Return the signal signature
**/ **/
PYSIDE_API void addSignalToWrapper(SbkBaseType* wrapperType, const char* signalName, PySideSignal* signal); PYSIDE_API void addSignalToWrapper(SbkObjectType* wrapperType, const char* signalName, PySideSignal* signal);
/** /**
* This function verify if the signature is a QtSignal base on SIGNAL flag * This function verify if the signature is a QtSignal base on SIGNAL flag

View file

@ -379,7 +379,7 @@ bool SignalManager::registerMetaMethod(QObject* source, const char* signature, Q
// Create the dynamic signal is needed // Create the dynamic signal is needed
if (methodIndex == -1) { if (methodIndex == -1) {
SbkObject* self = Shiboken::BindingManager::instance().retrieveWrapper(source); SbkObject* self = Shiboken::BindingManager::instance().retrieveWrapper(source);
if (!Shiboken::Wrapper::hasCppWrapper(self)) { if (!Shiboken::Object::hasCppWrapper(self)) {
qWarning() << "Invalid Signal signature:" << signature; qWarning() << "Invalid Signal signature:" << signature;
return false; return false;
} else { } else {

View file

@ -117,11 +117,11 @@ QWidget* PyCustomWidget::createWidget(QWidget* parent)
QWidget* widget = 0; QWidget* widget = 0;
if (result) { if (result) {
if (unkowParent) //if parent does not exists in python, transfer the ownership to cpp if (unkowParent) //if parent does not exists in python, transfer the ownership to cpp
Shiboken::Wrapper::releaseOwnership(result); Shiboken::Object::releaseOwnership(result);
else else
Shiboken::Wrapper::setParent(pyParent, reinterpret_cast<PyObject*>(result)); Shiboken::Object::setParent(pyParent, reinterpret_cast<PyObject*>(result));
widget = reinterpret_cast<QWidget*>(Shiboken::Wrapper::cppPointer(result, result->ob_type)); widget = reinterpret_cast<QWidget*>(Shiboken::Object::cppPointer(result, result->ob_type));
} }
return widget; return widget;