[PyQt] casting issues

Matt Newell newellm at blur.com
Thu Sep 17 03:36:05 BST 2009


On Wednesday 16 September 2009 16:28:52 Diez B. Roggisch wrote:
> Hi,
>
> when wrapping a C++-library with SIP ( 4.9-snapshot-20090821) I run into
> a couple of issues.
>
> First of all, the library I wrap has a hierarchy of classes (all
> descending from ISceneNode) which I wrapped.
>
> Now through an instance of a so-called ISceneManager, I can access
> instances of the current scene-graph which are ISceneNode-instances.
> Consequently, the signature for one of the accessory-methods looks like
> this:
>
>    ISceneNode *getSceneNodeFromID(int)
>
> So far, so good.
>
> Now problem number one comes up: I *know* a certain node is of type e.g.
> IMeshSceneNode. But when I access it via the above method, all I get is
> an ISceneNode. My C++-foo is rusty, and I know that RTTI isn't always
> available - I just wonder: is there a way for SIP to figure out the
> actual type of the instance returned, and wrap it accordingly? If yes,
> what do I need to do to enable that feature?
>
> However, the library in question offers a getType()-call on ISceneNodes,
> and this I can use to write casting-code myself.
>

You need to implement %ConvertToSubClassCode, it's covered in the docs.

I have no idea about the crash.

Matt



More information about the PyQt mailing list