[PyQt] Access Python QObject from QML fails to convert on second call
Phil Thompson
phil at riverbankcomputing.com
Fri May 20 09:14:37 BST 2016
On 20 May 2016, at 6:42 am, Fabian Sturm <f at rtfs.org> wrote:
>
> 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?
I don't use QML. You could look at the PyQt examples. They seem to do the initial setup in a more simple way - no use of QQmlComponent.
Phil
More information about the PyQt
mailing list