diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2011-12-11 23:13:12 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:56:21 -0300 |
commit | 7bfbbf3cb784f8e22dde74ebe28ba5e5eda4b7db (patch) | |
tree | 0bd9c001bd2d6ff30f34c39aaf1a28c6233ffb43 /PySide/QtDeclarative | |
parent | aec20b21a5cfc678c8bd1e017d2300542edfbce7 (diff) |
No more training wheels. The last occurrences of the old template Converter where removed.
Also related fixes here and there.
Diffstat (limited to 'PySide/QtDeclarative')
-rw-r--r-- | PySide/QtDeclarative/pysideqmlregistertype.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/PySide/QtDeclarative/pysideqmlregistertype.cpp b/PySide/QtDeclarative/pysideqmlregistertype.cpp index 30844c671..4efc4bf77 100644 --- a/PySide/QtDeclarative/pysideqmlregistertype.cpp +++ b/PySide/QtDeclarative/pysideqmlregistertype.cpp @@ -282,12 +282,13 @@ int propListCount(QDeclarativeListProperty<QDeclarativeItem>* propList) Shiboken::AutoDecRef retVal(PyObject_CallObject(data->count, args)); // Check return type + int cppResult = 0; + PythonToCppFunc pythonToCpp; if (PyErr_Occurred()) PyErr_Print(); - else if (Shiboken::Converter<int>::isConvertible(retVal)) - return Shiboken::Converter<int>::toCpp(retVal); - - return 0; + else if ((pythonToCpp = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter<int>(), retVal))) + pythonToCpp(retVal, &cppResult); + return cppResult; } // Implementation of QDeclarativeListProperty<T>::AtFunction callback @@ -302,12 +303,12 @@ QDeclarativeItem* propListAt(QDeclarativeListProperty<QDeclarativeItem>* propLis DeclarativeListProperty* data = reinterpret_cast<DeclarativeListProperty*>(propList->data); Shiboken::AutoDecRef retVal(PyObject_CallObject(data->at, args)); + QDeclarativeItem* result = 0; if (PyErr_Occurred()) PyErr_Print(); else if (PyType_IsSubtype(Py_TYPE(retVal), data->type)) - return Shiboken::Converter<QDeclarativeItem*>::toCpp(retVal); - - return 0; + Shiboken::Conversions::pythonToCppPointer((SbkObjectType*)SbkPySide_QtCoreTypes[SBK_QDECLARATIVEITEM_IDX], retVal, &result); + return result; } // Implementation of QDeclarativeListProperty<T>::ClearFunction callback @@ -332,7 +333,9 @@ static void propListMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::Ca return; DeclarativeListProperty* data = reinterpret_cast<DeclarativeListProperty*>(PySide::Property::userData(pp)); - QDeclarativeListProperty<QDeclarativeItem> declProp(Shiboken::Converter<QObject*>::toCpp(self), data, &propListAppender); + QObject* qobj; + Shiboken::Conversions::pythonToCppPointer((SbkObjectType*)SbkPySide_QtCoreTypes[SBK_QOBJECT_IDX], self, &qobj); + QDeclarativeListProperty<QDeclarativeItem> declProp(qobj, data, &propListAppender); if (data->count) declProp.count = &propListCount; |