aboutsummaryrefslogtreecommitdiffstats
path: root/PySide/QtGui/qpixmap_conversion.h
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.lima@openbossa.org>2010-06-08 09:57:21 -0300
committerHugo Parente Lima <hugo.lima@openbossa.org>2010-06-10 14:57:42 -0300
commitccd189d30c284e9a67a802193ef05c4149108f9a (patch)
tree9cad80bbabd36375c7dac046b386cc599bf3f942 /PySide/QtGui/qpixmap_conversion.h
parente39bfefde9edda662f51eeaf9a482f209c7f1217 (diff)
Add checkType method to PySide custom converters.
Diffstat (limited to 'PySide/QtGui/qpixmap_conversion.h')
-rw-r--r--PySide/QtGui/qpixmap_conversion.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/PySide/QtGui/qpixmap_conversion.h b/PySide/QtGui/qpixmap_conversion.h
index 10b48035..1423959a 100644
--- a/PySide/QtGui/qpixmap_conversion.h
+++ b/PySide/QtGui/qpixmap_conversion.h
@@ -1,14 +1,19 @@
namespace Shiboken {
-inline bool Converter< QPixmap >::isConvertible(PyObject* pyobj)
+inline bool Converter<QPixmap>::checkType(PyObject* pyObj)
+{
+ return ValueTypeConverter<QPixmap>::checkType(pyObj);
+}
+
+inline bool Converter<QPixmap>::isConvertible(PyObject* pyobj)
{
if (ValueTypeConverter<QPixmap>::isConvertible(pyobj))
return true;
SbkBaseWrapperType* shiboType = reinterpret_cast<SbkBaseWrapperType*>(SbkType<QPixmap>());
- bool isVariant = SbkQVariant_Check(pyobj);
+ bool isVariant = Converter<QVariant>::checkType(pyobj);
if (isVariant) {
QVariant var(Converter<QVariant>::toCpp(pyobj));
return var.type() == QVariant::Pixmap;
- } else if (SbkQSize_Check(pyobj) || SbkQString_Check(pyobj)) {
+ } else if (Converter<QSize>::checkType(pyobj) || Converter<QString>::checkType(pyobj)) {
return true;
} else if (shiboType->ext_isconvertible) {
return shiboType->ext_isconvertible(pyobj);
@@ -17,17 +22,17 @@ inline bool Converter< QPixmap >::isConvertible(PyObject* pyobj)
}
-inline QPixmap Converter< QPixmap >::toCpp(PyObject* pyobj)
+inline QPixmap Converter<QPixmap>::toCpp(PyObject* pyobj)
{
SbkBaseWrapperType* shiboType = reinterpret_cast<SbkBaseWrapperType*>(SbkType<QPixmap>());
- bool isVariant = SbkQVariant_Check(pyobj);
+ bool isVariant = Converter<QVariant>::checkType(pyobj);
if (isVariant) {
QVariant var(Converter<QVariant>::toCpp(pyobj));
return var.value<QPixmap>();
- } else if (SbkQSize_Check(pyobj)) {
- return QPixmap(Shiboken::Converter<QSize& >::toCpp(pyobj));
- } else if (SbkQString_Check(pyobj)) {
- return QPixmap(Shiboken::Converter<QString& >::toCpp(pyobj));
+ } else if (Converter<QSize>::checkType(pyobj)) {
+ return QPixmap(Shiboken::Converter<QSize >::toCpp(pyobj));
+ } else if (Converter<QString>::checkType(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);