aboutsummaryrefslogtreecommitdiffstats
path: root/PySide
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-07-05 14:18:43 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-07-05 17:39:14 -0300
commit72235a6530831a13c940839c53e873740fad71b7 (patch)
tree5980e9ea9b9c5b27425b71df505fd35a771de421 /PySide
parentbc4aa5ca947be692a6d016b349b1e2959a9bedf2 (diff)
Use original name on QVariant type lookup function.
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>, Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'PySide')
-rw-r--r--PySide/QtCore/qvariant_conversions.h27
1 files changed, 12 insertions, 15 deletions
diff --git a/PySide/QtCore/qvariant_conversions.h b/PySide/QtCore/qvariant_conversions.h
index 076ed7f92..613e523d2 100644
--- a/PySide/QtCore/qvariant_conversions.h
+++ b/PySide/QtCore/qvariant_conversions.h
@@ -45,21 +45,14 @@ struct Converter<QVariant>
return QVariant::fromValue<PySide::PyObjectWrapper>(pyObj);
} else {
// a class supported by QVariant?
- const char* typeName = pyObj->ob_type->tp_name;
- // check if the name starts with PySide.
- if (!strncmp("PySide.", typeName, 7)) {
- // get the type name
- const char* lastDot = typeName;
- for (int i = 8; typeName[i]; ++i) {
- if (typeName[i] == '.')
- lastDot = &typeName[i];
- }
- lastDot++;
- uint typeCode = QMetaType::type(lastDot);
+ if (Shiboken::isShibokenType(pyObj)) {
+ 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 typeName(lastDot);
- typeName += '*';
- typeCode = QMetaType::type(typeName.toAscii());
+ QString stypeName(typeName);
+ stypeName += '*';
+ typeCode = QMetaType::type(stypeName.toAscii());
}
if (typeCode)
return QVariant(typeCode, reinterpret_cast<SbkBaseWrapper*>(pyObj)->cptr[0]);
@@ -69,7 +62,11 @@ struct Converter<QVariant>
}
}
- static PyObject* toPython(void* cppObj) { return toPython(*reinterpret_cast<QVariant*>(cppObj)); }
+ static PyObject* toPython(void* cppObj)
+ {
+ return toPython(*reinterpret_cast<QVariant*>(cppObj));
+ }
+
static PyObject* toPython(const QVariant& cppObj)
{
if (cppObj.isValid()) {