[PySide] inter-object communications
Henry Gomersall
heng at cantab.net
Fri Nov 8 18:18:13 CET 2013
On 08/11/13 16:17, John Ehresman wrote:
> On 11/8/13 11:01 AM, Henry Gomersall wrote:
>> Ah, ok. So PySide creates a parallel class heirarchy, with methods that
>> can call back into Python. Out of interest, how is this check on being a
>> python implemented subclass performed? (a pointer to the relevant code
>> would be awesome!).
>
> At a high level, the code for a method named "foo" is (untested code
> that omits error handling and ref counting):
> C++WrapperClass::foo(args...)
> {
> override = PyObject_GetAttrString(pySelf, "foo");
> if (override != NULL) {
> result = PyObject_Call(override, args...);
> return result;
> }
> else {
> return C++BaseClass::foo(args...);
> }
> }
>
> Best way to get a more detailed look (for me, at least) is to look at
> the generated code. In a built PySide tree, look at
> PySide/QtGui/PySide/QtGui/qwidget_wrapper.cpp in the build directory.
> The QWidgetWrapper::setVisible method is the override for the
> QWidget::setVisible method.
That is interesting.
Thanks,
Henry
More information about the PySide
mailing list