I can't seem to find much guidance on this issue anywhere online. I have been learning PySide and have noticed that half of the examples out there just set the parent
of QStuff to None
while other examples will set it to an object. I realize there may be a garbage collection issue at play. Say I have a QWidget object and I create and reference a QThing with its parent
set to QWidget, then I .add
the QThing to QWidget. It seems like I should then have circular references somewhere. Python does reference counting, so this would mean that the objects won't get garbage collected. Even something like
self.addWidget(QLabel('label', self))
would result in a circular reference (Though I imagine this case is handled by PySide.) Maybe I am worrying too much and all this is handled, I don't know.
In Short: What is the right way to use parents in PySide?