aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-09-09 14:26:20 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-09-09 14:43:27 -0300
commit64663cdb4ef1c64b362c1693a3243df0e3818c1a (patch)
treed0064438b002454e5ce28063b0a598cac4c55524
parent3ef0527eaf0a9cc296c899f67ec4821f1ad1f073 (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>
-rw-r--r--PySide/QtCore/qvariant_conversions.h13
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);