Adapt to changes in libshiboken

Reviewer: Anderson Lizardo <anderson.lizardo@openbossa.org>
Reviewer: Bruno Araújo <bruno.araujo@openbossa.org>
This commit is contained in:
Hugo Lima 2010-03-30 12:01:10 -03:00
commit 5bd8147956
5 changed files with 14 additions and 8 deletions

View file

@ -31,9 +31,12 @@ int SbkQCoreApplication_Init(PyObject* self, PyObject* args, PyObject*)
return -1; return -1;
} }
SbkBaseWrapper_setCptr(self, new QCoreApplication(QCoreApplicationArgCount, QCoreApplicationArgValues)); void* cptr = new QCoreApplication(QCoreApplicationArgCount, QCoreApplicationArgValues);
Shiboken::setCppPointer(reinterpret_cast<SbkBaseWrapper*>(self),
Shiboken::SbkType<QCoreApplication>(),
cptr);
SbkBaseWrapper_setValidCppObject(self, 1); SbkBaseWrapper_setValidCppObject(self, 1);
Shiboken::BindingManager::instance().registerWrapper(reinterpret_cast<SbkBaseWrapper*>(self)); Shiboken::BindingManager::instance().registerWrapper(reinterpret_cast<SbkBaseWrapper*>(self), cptr);
Py_INCREF(self); Py_INCREF(self);
Py_AtExit(DeleteQCoreApplicationAtExit); Py_AtExit(DeleteQCoreApplicationAtExit);

View file

@ -82,7 +82,7 @@ inline QVariant Converter<QVariant>::toCpp(PyObject* pyobj)
} }
} else { } else {
// Is a known Qt type // Is a known Qt type
return QVariant(typeCode, reinterpret_cast<SbkBaseWrapper*>(pyobj)->cptr); return QVariant(typeCode, reinterpret_cast<SbkBaseWrapper*>(pyobj)->cptr[0]);
} }
} }

View file

@ -2786,7 +2786,7 @@
// The normal here would be to use the 'reference-count' tag but this // The normal here would be to use the 'reference-count' tag but this
// method is strongly tied to 'setTargetState' since both affect the same // method is strongly tied to 'setTargetState' since both affect the same
// internal value in QAbstractTransition. // internal value in QAbstractTransition.
Shiboken::SbkBaseWrapper_keepReference(reinterpret_cast&lt;SbkBaseWrapper*&gt;(%PYSELF), "setTargetState(QAbstractState*)1", %PYARG_1); Shiboken::keepReference(reinterpret_cast&lt;SbkBaseWrapper*&gt;(%PYSELF), "setTargetState(QAbstractState*)1", %PYARG_1);
</inject-code> </inject-code>
</modify-function> </modify-function>

View file

@ -30,9 +30,12 @@ int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*)
return -1; return -1;
} }
SbkBaseWrapper_setCptr(self, new QApplication(QApplicationArgCount, QApplicationArgValues)); void* cptr = new QApplication(QApplicationArgCount, QApplicationArgValues);
Shiboken::setCppPointer(reinterpret_cast<SbkBaseWrapper*>(self),
Shiboken::SbkType<QApplication>(),
cptr);
SbkBaseWrapper_setValidCppObject(self, 1); SbkBaseWrapper_setValidCppObject(self, 1);
Shiboken::BindingManager::instance().registerWrapper(reinterpret_cast<SbkBaseWrapper*>(self)); Shiboken::BindingManager::instance().registerWrapper(reinterpret_cast<SbkBaseWrapper*>(self), cptr);
// Verify if qApp is in main module // Verify if qApp is in main module
const char QAPP_MACRO[] = "qApp"; const char QAPP_MACRO[] = "qApp";

View file

@ -78,7 +78,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*>(SbkBaseWrapper_cptr(pyobj)); return *reinterpret_cast<QtDict*>(Shiboken::getCppPointer(pyobj, Shiboken::SbkType<QtDict>()));
QtDict result; QtDict result;
@ -121,7 +121,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*>(SbkBaseWrapper_cptr(pyobj)); return *reinterpret_cast<T*>(Shiboken::getCppPointer(pyobj, Shiboken::SbkType<T>()));
T result; T result;
for (int i = 0; i < PySequence_Size(pyobj); i++) { for (int i = 0; i < PySequence_Size(pyobj); i++) {