[PyQt] Trouble with parenting in loaded .ui... but only on first load?

Kyle Altendorf sda at fstab.net
Fri Dec 28 16:50:28 GMT 2018


https://gist.github.com/altendky/b49af568393c2a4c597cdfbcbdfd5bdb

When loading the bad.ui which has a QStackedWidget holding the 
QTabWidget. Subsequent loads in the same process seem ok. The issue 
directly observed in my original code was that .findChildren() was 
unable to find the nvview.NvView widget. Here we can see that the 
QTabWidget isn't getting it's parent set to the QStackedWidget. I am 
assuming the QStackedWidget with the QTabWidget as the parent (in both 
bad and good cases) is an expected internal piece of the QTabWidget 
implementation.

The good.ui does not have the QStackedWidget and seems to load fine 
regardless.

I tested this for each version on pypi back to 5.8 and they all seem to 
act the same. I have had code 'like' this (I deleted 99% or whatever to 
get down to this sscce) for a long time and it's been fine. I'm not sure 
why I started running into this only recently when I tried to add 
another tab.

Any help understanding and solving this would be great.

Cheers,
-kyle


More information about the PyQt mailing list