diff options
author | renatofilho <renato.filho@openbossa.org> | 2010-10-14 16:32:29 -0300 |
---|---|---|
committer | renatofilho <renato.filho@openbossa.org> | 2010-10-15 13:50:18 -0300 |
commit | 5c9afb798ecc9ec29622464c9c96909a2e79f220 (patch) | |
tree | 4805322ddcdd69a014c73fc9f3a41c3d8a9564bd /PySide | |
parent | 83f8447c9546f53c134a10f02e81abdab88aed3a (diff) |
WId conversions used on Windows OS.
Fixes bug #399.
Reviewer: Hugo Parente Lima <hugo.pl@gmail.com>
Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'PySide')
-rw-r--r-- | PySide/QtGui/glue/wid_conversions.h | 32 | ||||
-rw-r--r-- | PySide/QtGui/typesystem_gui_win.xml | 5 |
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 000000000..9901218a1 --- /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 bc4690925..124929674 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> |