[PyQt] QGraphicsObject added to scene transforms into something else?

Alan Ezust alan.ezust at gmail.com
Fri Feb 13 17:58:51 GMT 2015


That fixed me! Thanks again!
--Alan


On Fri, Feb 13, 2015 at 8:26 AM, Phil Thompson <phil at riverbankcomputing.com>
wrote:

> 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
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150213/5021bf9c/attachment.html>


More information about the PyQt mailing list