Fixed QKeySequence convertion to QVariant.
Fixes bug #775. Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
This commit is contained in:
parent
94571574b4
commit
5d3285e41d
2 changed files with 12 additions and 11 deletions
|
|
@ -82,16 +82,10 @@ struct Converter<QVariant>
|
||||||
} else if (Shiboken::isShibokenEnum(pyObj)) {
|
} else if (Shiboken::isShibokenEnum(pyObj)) {
|
||||||
// QVariant(enum)
|
// QVariant(enum)
|
||||||
return QVariant(Converter<int>::toCpp(pyObj));
|
return QVariant(Converter<int>::toCpp(pyObj));
|
||||||
} else if (PyDict_Check(pyObj)) {
|
} else if (Shiboken::Object::checkType(pyObj)) {
|
||||||
return convertToVariantMap(pyObj);
|
|
||||||
} else if (PySequence_Check(pyObj)) {
|
|
||||||
return convertToVariantList(pyObj);
|
|
||||||
} else {
|
|
||||||
// a class supported by QVariant?
|
// a class supported by QVariant?
|
||||||
if (Shiboken::Object::checkType(pyObj)) {
|
|
||||||
int typeCode;
|
int typeCode;
|
||||||
const char* typeName = resolveMetaType(pyObj->ob_type, &typeCode);
|
const char* typeName = resolveMetaType(pyObj->ob_type, &typeCode);
|
||||||
|
|
||||||
if (typeCode && typeName) {
|
if (typeCode && typeName) {
|
||||||
Shiboken::TypeResolver* tr = Shiboken::TypeResolver::get(typeName);
|
Shiboken::TypeResolver* tr = Shiboken::TypeResolver::get(typeName);
|
||||||
QVariant var(typeCode, (void*)0);
|
QVariant var(typeCode, (void*)0);
|
||||||
|
|
@ -99,10 +93,17 @@ struct Converter<QVariant>
|
||||||
tr->toCpp(pyObj, args);
|
tr->toCpp(pyObj, args);
|
||||||
return var;
|
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)
|
static PyObject* toPython(void* cppObj)
|
||||||
|
|
|
||||||
|
|
@ -493,7 +493,7 @@
|
||||||
</inject-code>
|
</inject-code>
|
||||||
</add-function>
|
</add-function>
|
||||||
|
|
||||||
<!-- ### See bug 775 -->
|
<!-- ### Not necessary due the PySide QVariant conversion rules -->
|
||||||
<modify-function signature="operator QVariant()const" remove="all"/>
|
<modify-function signature="operator QVariant()const" remove="all"/>
|
||||||
<!-- ### Obsolete -->
|
<!-- ### Obsolete -->
|
||||||
<modify-function signature="operator int()const" remove="all"/>
|
<modify-function signature="operator int()const" remove="all"/>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue