diff options
author | Renato Filho <renato.filho@openbossa.org> | 2010-09-09 14:26:20 -0300 |
---|---|---|
committer | Renato Filho <renato.filho@openbossa.org> | 2010-09-09 14:43:27 -0300 |
commit | 64663cdb4ef1c64b362c1693a3243df0e3818c1a (patch) | |
tree | d0064438b002454e5ce28063b0a598cac4c55524 /PySide/QtCore/qvariant_conversions.h | |
parent | 3ef0527eaf0a9cc296c899f67ec4821f1ad1f073 (diff) |
Fixed QVariant conversion from Python object.
Fixes bug #346, #338
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
Diffstat (limited to 'PySide/QtCore/qvariant_conversions.h')
-rw-r--r-- | PySide/QtCore/qvariant_conversions.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/PySide/QtCore/qvariant_conversions.h b/PySide/QtCore/qvariant_conversions.h index 1e1c70578..06a8368cd 100644 --- a/PySide/QtCore/qvariant_conversions.h +++ b/PySide/QtCore/qvariant_conversions.h @@ -56,14 +56,13 @@ struct Converter<QVariant> Shiboken::SbkBaseWrapperType *objType = reinterpret_cast<Shiboken::SbkBaseWrapperType*>(pyObj->ob_type); const char* typeName = objType->original_name; uint typeCode = QMetaType::type(typeName); - if (!typeCode) {// Try with star at end, for QObject*, QWidget* and QAbstractKinectScroller* - QString stypeName(typeName); - stypeName += '*'; - typeCode = QMetaType::type(stypeName.toAscii()); - return QVariant(typeCode, reinterpret_cast<SbkBaseWrapper*>(pyObj)->cptr); + if (typeCode) { + void** data = reinterpret_cast<SbkBaseWrapper*>(pyObj)->cptr; + if (typeName[strlen(typeName)-1] == '*') + return QVariant(typeCode, data); + else + return QVariant(typeCode, data[0]); } - if (typeCode) - return QVariant(typeCode, reinterpret_cast<SbkBaseWrapper*>(pyObj)->cptr[0]); } // Is a shiboken type not known by Qt return QVariant::fromValue<PySide::PyObjectWrapper>(pyObj); |