summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrenatofilho <renato.filho@openbossa.org>2010-11-10 12:53:28 -0300
committerrenatofilho <renato.filho@openbossa.org>2010-11-10 18:52:10 -0300
commita623a57d0660e4490c370da7167db3a794f5162e (patch)
treee0e4738f6026d58f8bae2bd3fc8c65277d3a82b2
parent66ff08586178ffb601fe874d48b9847fb577f513 (diff)
downloadpyside-a623a57d0660e4490c370da7167db3a794f5162e.tar.gz
pyside-a623a57d0660e4490c370da7167db3a794f5162e.tar.xz
pyside-a623a57d0660e4490c370da7167db3a794f5162e.zip
Fixed QVariant conversions for object types.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r--PySide/QtCore/qvariant_conversions.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/PySide/QtCore/qvariant_conversions.h b/PySide/QtCore/qvariant_conversions.h
index b47e389..9363a25 100644
--- a/PySide/QtCore/qvariant_conversions.h
+++ b/PySide/QtCore/qvariant_conversions.h
@@ -18,7 +18,12 @@ struct Converter<QVariant>
{
if (PyObject_TypeCheck(type, &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);
if (obTypeId) {
@@ -27,7 +32,7 @@ struct Converter<QVariant>
}
// Do not resolve types to value type
- if (!QByteArray(typeName).endsWith("*"))
+ if (valueType)
return QByteArray();
// find in base types
@@ -81,7 +86,7 @@ struct Converter<QVariant>
return convertToVariantList(pyObj);
} else {
// 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);
int typeCode = 0;
QByteArray typeName = resolveMetaType(reinterpret_cast<PyTypeObject*>(objType), typeCode);