diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-04-25 15:54:00 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:14 -0300 |
commit | 5d3285e41d53de399da93ecebcef04b3dc3616ee (patch) | |
tree | fe0a64d360fd71f268cb525c2ffea3fe61203b23 | |
parent | 94571574b496bbf7b6658b4dc0aae60386a612fa (diff) |
Fixed QKeySequence convertion to QVariant.
Fixes bug #775.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
-rw-r--r-- | PySide/QtCore/qvariant_conversions.h | 21 | ||||
-rw-r--r-- | PySide/QtGui/typesystem_gui_common.xml | 2 |
2 files changed, 12 insertions, 11 deletions
diff --git a/PySide/QtCore/qvariant_conversions.h b/PySide/QtCore/qvariant_conversions.h index 283cf4f4f..73e2aa462 100644 --- a/PySide/QtCore/qvariant_conversions.h +++ b/PySide/QtCore/qvariant_conversions.h @@ -82,16 +82,10 @@ struct Converter<QVariant> } else if (Shiboken::isShibokenEnum(pyObj)) { // QVariant(enum) return QVariant(Converter<int>::toCpp(pyObj)); - } else if (PyDict_Check(pyObj)) { - return convertToVariantMap(pyObj); - } else if (PySequence_Check(pyObj)) { - return convertToVariantList(pyObj); - } else { + } else if (Shiboken::Object::checkType(pyObj)) { // a class supported by QVariant? - if (Shiboken::Object::checkType(pyObj)) { int typeCode; const char* typeName = resolveMetaType(pyObj->ob_type, &typeCode); - if (typeCode && typeName) { Shiboken::TypeResolver* tr = Shiboken::TypeResolver::get(typeName); QVariant var(typeCode, (void*)0); @@ -99,10 +93,17 @@ struct Converter<QVariant> tr->toCpp(pyObj, args); return var; } - } - // Is a shiboken type not known by Qt - return QVariant::fromValue<PySide::PyObjectWrapper>(pyObj); } + + //sequence and dictornay + if (PyDict_Check(pyObj)) { + return convertToVariantMap(pyObj); + } else if (PySequence_Check(pyObj)) { + return convertToVariantList(pyObj); + } + + // Is a shiboken type not known by Qt + return QVariant::fromValue<PySide::PyObjectWrapper>(pyObj); } static PyObject* toPython(void* cppObj) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index e5d6281ec..fa484bc13 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -493,7 +493,7 @@ </inject-code> </add-function> - <!-- ### See bug 775 --> + <!-- ### Not necessary due the PySide QVariant conversion rules --> <modify-function signature="operator QVariant()const" remove="all"/> <!-- ### Obsolete --> <modify-function signature="operator int()const" remove="all"/> |