aboutsummaryrefslogtreecommitdiffstats
path: root/PySide/QtGui/qpixmap_conversion.h
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-02-01 15:29:09 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-02-01 20:35:42 -0300
commite864bdf57e2c549ad5f8f6f8b966dadca6f1ee68 (patch)
tree1c44621a846a9b29686734227273d4fbc6aa5a24 /PySide/QtGui/qpixmap_conversion.h
parente4919faa31215b55ec6f95ca0ff58ba6dd011124 (diff)
QPixmap conversion from QVariant.
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Diffstat (limited to 'PySide/QtGui/qpixmap_conversion.h')
-rw-r--r--PySide/QtGui/qpixmap_conversion.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/PySide/QtGui/qpixmap_conversion.h b/PySide/QtGui/qpixmap_conversion.h
new file mode 100644
index 00000000..18e3ce91
--- /dev/null
+++ b/PySide/QtGui/qpixmap_conversion.h
@@ -0,0 +1,27 @@
+inline bool Converter< QPixmap >::isConvertible(PyObject* pyobj)
+{
+ 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;
+ }
+ return false;
+
+}
+
+inline QPixmap Converter< QPixmap >::toCpp(PyObject* pyobj)
+{
+ bool isVariant = SbkQVariant_Check(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));
+ }
+
+ return *SbkQPixmap_cptr(pyobj);
+}