summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrenatofilho <renato.filho@openbossa.org>2010-10-14 16:32:29 -0300
committerrenatofilho <renato.filho@openbossa.org>2010-10-15 13:50:18 -0300
commit5c9afb798ecc9ec29622464c9c96909a2e79f220 (patch)
tree4805322ddcdd69a014c73fc9f3a41c3d8a9564bd
parent83f8447c9546f53c134a10f02e81abdab88aed3a (diff)
downloadpyside-5c9afb798ecc9ec29622464c9c96909a2e79f220.tar.gz
pyside-5c9afb798ecc9ec29622464c9c96909a2e79f220.tar.xz
pyside-5c9afb798ecc9ec29622464c9c96909a2e79f220.zip
WId conversions used on Windows OS.
Fixes bug #399. Reviewer: Hugo Parente Lima <hugo.pl@gmail.com> Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r--PySide/QtGui/glue/wid_conversions.h32
-rw-r--r--PySide/QtGui/typesystem_gui_win.xml5
2 files changed, 36 insertions, 1 deletions
diff --git a/PySide/QtGui/glue/wid_conversions.h b/PySide/QtGui/glue/wid_conversions.h
new file mode 100644
index 0000000..9901218
--- /dev/null
+++ b/PySide/QtGui/glue/wid_conversions.h
@@ -0,0 +1,32 @@
+namespace Shiboken {
+template <>
+struct Converter<WId>
+{
+ static bool checkType(PyObject* pyObj)
+ {
+ return false;
+ }
+
+ static bool isConvertible(PyObject* pyobj)
+ {
+ return PyCObject_Check(pyobj);
+ }
+
+ static inline PyObject* toPython(void* cppobj)
+ {
+ // not supported
+ Q_ASSERT(true);
+ return 0;
+ }
+
+ static PyObject* toPython(WId cppobj)
+ {
+ return PyCObject_FromVoidPtr(cppobj, 0);
+ }
+
+ static WId toCpp(PyObject* pyobj)
+ {
+ return (WId) PyCObject_AsVoidPtr(pyobj);
+ }
+};
+}
diff --git a/PySide/QtGui/typesystem_gui_win.xml b/PySide/QtGui/typesystem_gui_win.xml
index bc46909..1249296 100644
--- a/PySide/QtGui/typesystem_gui_win.xml
+++ b/PySide/QtGui/typesystem_gui_win.xml
@@ -19,6 +19,9 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-->
<typesystem package="PySide.QtGui">
- <primitive-type name="Qt::HANDLE" target-lang-api-name="PyObject"/>
+ <primitive-type name="Qt::HANDLE" target-lang-api-name="PyObject" />
+ <primitive-type name="WId" target-lang-api-name="PyObject">
+ <conversion-rule file="glue/wid_conversions.h"/>
+ </primitive-type>
<enum-type name="QPixmap::HBitmapFormat" />
</typesystem>