diff options
-rw-r--r-- | PySide/QtGui/glue/wid_conversions.h | 25 | ||||
-rw-r--r-- | PySide/QtGui/typesystem_gui_common.xml | 2 |
2 files changed, 4 insertions, 23 deletions
diff --git a/PySide/QtGui/glue/wid_conversions.h b/PySide/QtGui/glue/wid_conversions.h index 183e682fe..68d752884 100644 --- a/PySide/QtGui/glue/wid_conversions.h +++ b/PySide/QtGui/glue/wid_conversions.h @@ -11,14 +11,7 @@ struct Converter<WId> static bool isConvertible(PyObject* pyobj) { - if (pyobj == Py_None) - return true; - -#ifdef IS_PY3K - return PyCapsule_CheckExact(pyobj); -#else - return PyCObject_Check(pyobj); -#endif + return pyobj == Py_None || PyNumber_Check(pyobj); } static inline PyObject* toPython(void* cppobj) @@ -30,26 +23,14 @@ struct Converter<WId> static PyObject* toPython(WId cppobj) { - if (!cppobj) - Py_RETURN_NONE; - -#ifdef IS_PY3K - return PyCapsule_New(cppobj, 0, 0); -#else - return PyCObject_FromVoidPtr(cppobj, 0); -#endif + return PyLong_FromVoidPtr((void*)cppobj); } static WId toCpp(PyObject* pyobj) { if (pyobj == Py_None) return 0; - -#ifdef IS_PY3K - return (WId)PyCapsule_GetPointer(pyobj, 0); -#else - return (WId)PyCObject_AsVoidPtr(pyobj); -#endif + return (WId)PyLong_AsVoidPtr(pyobj); } }; diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 755f4a971..e4a6f440f 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -4245,7 +4245,7 @@ If a widget is non-native (alien) and winId() is invoked on it, that widget will be provided a native handle. - On X11 the type returned is long, on other platforms it's a PyCObject. + On X11 the type returned is long, on other platforms it's void pointer casted to a Python long long. This value may change at run-time. An event with type PySide.QtCore.QEvent.WinIdChange will be sent to the widget following a change in window system identifier. </inject-documentation> |