Fixed QVariant conversions for object types.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
parent
66ff085861
commit
a623a57d06
1 changed files with 8 additions and 3 deletions
|
|
@ -18,7 +18,12 @@ struct Converter<QVariant>
|
||||||
{
|
{
|
||||||
if (PyObject_TypeCheck(type, &Shiboken::SbkBaseWrapperType_Type)) {
|
if (PyObject_TypeCheck(type, &Shiboken::SbkBaseWrapperType_Type)) {
|
||||||
Shiboken::SbkBaseWrapperType *sbkType = reinterpret_cast<Shiboken::SbkBaseWrapperType*>(type);
|
Shiboken::SbkBaseWrapperType *sbkType = reinterpret_cast<Shiboken::SbkBaseWrapperType*>(type);
|
||||||
const char* typeName = sbkType->original_name;
|
QByteArray typeName(sbkType->original_name);
|
||||||
|
bool valueType = !typeName.endsWith("*");
|
||||||
|
|
||||||
|
// Do not convert user type of value
|
||||||
|
if (valueType && sbkType->is_user_type)
|
||||||
|
return QByteArray();
|
||||||
|
|
||||||
int obTypeId = QMetaType::type(typeName);
|
int obTypeId = QMetaType::type(typeName);
|
||||||
if (obTypeId) {
|
if (obTypeId) {
|
||||||
|
|
@ -27,7 +32,7 @@ struct Converter<QVariant>
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not resolve types to value type
|
// Do not resolve types to value type
|
||||||
if (!QByteArray(typeName).endsWith("*"))
|
if (valueType)
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
|
||||||
// find in base types
|
// find in base types
|
||||||
|
|
@ -81,7 +86,7 @@ struct Converter<QVariant>
|
||||||
return convertToVariantList(pyObj);
|
return convertToVariantList(pyObj);
|
||||||
} else {
|
} else {
|
||||||
// a class supported by QVariant?
|
// a class supported by QVariant?
|
||||||
if (Shiboken::isShibokenType(pyObj) && !Shiboken::isUserType(pyObj)) {
|
if (Shiboken::isShibokenType(pyObj)) {
|
||||||
Shiboken::SbkBaseWrapperType *objType = reinterpret_cast<Shiboken::SbkBaseWrapperType*>(pyObj->ob_type);
|
Shiboken::SbkBaseWrapperType *objType = reinterpret_cast<Shiboken::SbkBaseWrapperType*>(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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue