aboutsummaryrefslogtreecommitdiffstats
path: root/PySide
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-12-09 11:21:38 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:56:17 -0300
commit93bb5d777e6db0ba8d2b216832bf4211476c581e (patch)
tree24bc0e6fd68b48e5f4bdd609474def71313a7699 /PySide
parente3814f27dd3975b5be5a2f328353fe7d144ce23b (diff)
Fix bug 1083 - "winId returns a PyCObject making it impossible to compare two winIds"
Diffstat (limited to 'PySide')
-rw-r--r--PySide/QtGui/glue/wid_conversions.h25
-rw-r--r--PySide/QtGui/typesystem_gui_common.xml2
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>