aboutsummaryrefslogtreecommitdiffstats
path: root/PySide/QtCore
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-03-02 13:30:38 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-03-04 17:14:12 -0300
commit77bb1220b4bc7d538d1e57cf6011d7b3fbe42925 (patch)
tree0dcb3746487bf0be2b40ba39a65a5b6f390d621f /PySide/QtCore
parent4eafde570f4bb3d4bf663959959d8c1a0b221212 (diff)
Updated type system and QString and QPixmap conversions to be extensible.
And removed the QkeySequence test from the black list (the list of tests expected to fail). Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Lauro Moura <lauro.neto@openbossa.org>
Diffstat (limited to 'PySide/QtCore')
-rw-r--r--PySide/QtCore/qstring_conversions.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/PySide/QtCore/qstring_conversions.h b/PySide/QtCore/qstring_conversions.h
index 9a33d08d7..0456421da 100644
--- a/PySide/QtCore/qstring_conversions.h
+++ b/PySide/QtCore/qstring_conversions.h
@@ -1,6 +1,7 @@
namespace Shiboken {
inline bool Converter< QString >::isConvertible(PyObject* pyobj)
{
+ SbkBaseWrapperType* shiboType = reinterpret_cast<SbkBaseWrapperType*>(SbkType<QString>());
return PyString_Check(pyobj)
|| PyUnicode_Check(pyobj)
|| SbkQByteArray_Check(pyobj)
@@ -10,11 +11,13 @@ inline bool Converter< QString >::isConvertible(PyObject* pyobj)
&& PyType_HasFeature(pyobj->ob_type, Py_TPFLAGS_HAVE_GETCHARBUFFER)
&& pyobj->ob_type->tp_as_buffer->bf_getcharbuffer)
#endif
- || SbkQChar_Check(pyobj);
+ || SbkQChar_Check(pyobj)
+ || (shiboType->ext_isconvertible && shiboType->ext_isconvertible(pyobj));
}
inline QString Converter< QString >::toCpp(PyObject* pyobj)
{
+ SbkBaseWrapperType* shiboType = reinterpret_cast<SbkBaseWrapperType*>(SbkType<QString>());
if (SbkQChar_Check(pyobj)) {
return QString(Converter< QChar >::toCpp(pyobj));
} else if (SbkQByteArray_Check(pyobj)) {
@@ -50,6 +53,11 @@ inline QString Converter< QString >::toCpp(PyObject* pyobj)
return QString(data);
}
#endif
+ else if (shiboType->ext_isconvertible && shiboType->ext_tocpp && shiboType->ext_isconvertible(pyobj)) {
+ QString* cptr = reinterpret_cast<QString*>(shiboType->ext_tocpp(pyobj));
+ std::auto_ptr<QString> cptr_auto_ptr(cptr);
+ return *cptr;
+ }
return *Converter<QString*>::toCpp(pyobj);
}
}