[PyQt] Access Python QObject from QML fails to convert on second call

Fabian Sturm f at rtfs.org
Fri May 20 06:42:32 BST 2016


Thank you Phil!

I guess we are getting to the bottom of this soon. If I understand it
correctly. The ownership of the MyItem is transfered to the QML side
since it is returned through a method invocation and since the MyItems
don't have a parent they get garbage collected?

If this is true, the question is, how do I get a proper parent? The
model is instanciated in the QML code and never passes a parent in the
MyModel constructor. Otherwise I would have passed this into the
MyItem. 

How is this usally handled?

Thanks a lot,
Fabian

> The C++ QObject has been deleted but the corresponding Python object
> still exists.
> 
> Phil


More information about the PyQt mailing list