Hi Phil,

Phil Thompson wrote:
On Mon, 1 Nov 2010 17:26:41 -0700, Qin Shen <jeans...@tippett.com> wrote:
Hi,

In my non-template base class' .sip file, I used %ConvertToSubClassCode directive to downcast the base class type to its sub-class. If the sub-class is not a template, it all works fine. Now I need to derive a template sub-class from the base class, the sipFindType() won't work because there isn't any Python class implemented
for the templated sub-class. What should I do in this case?

So how is the template sub-class implemented in Python? Your
%ConvertToSubClassCode will need to explicitly check for the template
sub-class and return the appropriate Python type.
The .sip file of the template sub-class is based on its C++ .h header file.
Its implementation in the .sip file has been omitted since I thought I don't
need to put any implementation in the .sip file as its C++ header file has
been properly included.

When you asked how is the template sub-class implemented in Python, did you
mean that I need to put the C++ style implementation in .sip as well?

Do I need to use %MappedType to convert the template sub-class to/from a Python type. For a non-template class, sip usually generates a .cpp file for it as well
as a corresponding sipType_BLAH. In the case of a template class, neither
was generated. I don't see a direct type match between a Python type and any
specialization of the template sub-class, and no sipType_ is generated for
the template class, how am I supposed to convert the type?

Do you have any example on this?

Thanks a lot,

-Jean






_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to