aboutsummaryrefslogtreecommitdiffstats
path: root/PySide/QtGui/qpixmap_conversion.h
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/QtGui/qpixmap_conversion.h
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/QtGui/qpixmap_conversion.h')
-rw-r--r--PySide/QtGui/qpixmap_conversion.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/PySide/QtGui/qpixmap_conversion.h b/PySide/QtGui/qpixmap_conversion.h
index cad242b95..e3973b98c 100644
--- a/PySide/QtGui/qpixmap_conversion.h
+++ b/PySide/QtGui/qpixmap_conversion.h
@@ -1,12 +1,15 @@
namespace Shiboken {
inline bool Converter< QPixmap >::isConvertible(PyObject* pyobj)
{
+ SbkBaseWrapperType* shiboType = reinterpret_cast<SbkBaseWrapperType*>(SbkType<QPixmap>());
bool isVariant = SbkQVariant_Check(pyobj);
if (isVariant) {
QVariant var(Converter<QVariant>::toCpp(pyobj));
return var.type() == QVariant::Pixmap;
} else if (SbkQSize_Check(pyobj) || SbkQString_Check(pyobj)) {
return true;
+ } else if (shiboType->ext_isconvertible) {
+ return shiboType->ext_isconvertible(pyobj);
}
return false;
@@ -14,6 +17,7 @@ inline bool Converter< QPixmap >::isConvertible(PyObject* pyobj)
inline QPixmap Converter< QPixmap >::toCpp(PyObject* pyobj)
{
+ SbkBaseWrapperType* shiboType = reinterpret_cast<SbkBaseWrapperType*>(SbkType<QPixmap>());
bool isVariant = SbkQVariant_Check(pyobj);
if (isVariant) {
QVariant var(Converter<QVariant>::toCpp(pyobj));
@@ -22,6 +26,10 @@ inline QPixmap Converter< QPixmap >::toCpp(PyObject* pyobj)
return QPixmap(Shiboken::Converter<QSize& >::toCpp(pyobj));
} else if (SbkQString_Check(pyobj)) {
return QPixmap(Shiboken::Converter<QString& >::toCpp(pyobj));
+ } else if (shiboType->ext_isconvertible && shiboType->ext_tocpp && shiboType->ext_isconvertible(pyobj)) {
+ QPixmap* cptr = reinterpret_cast<QPixmap*>(shiboType->ext_tocpp(pyobj));
+ std::auto_ptr<QPixmap> cptr_auto_ptr(cptr);
+ return *cptr;
}
return *Converter<QPixmap*>::toCpp(pyobj);