[PyQt] QGraphicsObject added to scene transforms into something else?
Phil Thompson
phil at riverbankcomputing.com
Fri Feb 13 16:26:34 GMT 2015
On 13/02/2015 4:20 pm, Alan Ezust wrote:
> I don't have a test case yet, but I guess I will have to make one.
> Have any of you heard of a problem like this before?
>
> I created a QGraphicsObject-derived class.
> Added an instance to the scene.
> Before adding it, I can print it to stdout and see its type/address:
>
> <origame.gui.actor_2d_view.actor2d_view.PartWire2dItem object at
> 0x00000000062C48B8>
>
> But after I add it to the scene, this particular object "goes away" and
> in
> its place, I find this other item which I never added to the scene:
>
> <PyQt5.QtMultimediaWidgets.QGraphicsVideoItem object at
> 0x00000000062CF9D8>
>
> The item still paints itself as a PartWire2dItem should.
>
> Why would both the address and the type change as I add it to the
> scene?
> Is there some sort of class registration I need to do in order to my
> objects properly?
> Or could this be a side-effect of perhaps forgetting to implement one
> of
> the pure virtual functions?
>
> Sorry if this is not enough info for you to figure things out yet, I
> will
> post a testcase when I have one....
Make sure you re-implement type() and return a value greater than
UserType.
Phil
More information about the PyQt
mailing list