[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Trouble with parenting in loaded .ui... but only on first load?
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2018-12-28 22:23:56
Message-ID: 8A0E16DF-DA33-4B54-8AA6-A9DDE6D9C6FE () riverbankcomputing ! com
[Download RAW message or body]

On 28 Dec 2018, at 7:15 pm, Kyle Altendorf <sda@fstab.net> wrote:
> 
> On 2018-12-28 11:50, Kyle Altendorf wrote:
> > 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.
> 
> https://gist.github.com/altendky/983344eb45776b94395cf460713b92ce
> 
> I got some help in #pyqt digging into this.  I added some debugging to uiparser.py \
> and noticed that on the first load for bad, there were two reports of `UI version \
> is 4.0` in the logging.  bad.ui uses the custom widget which loads fileview.ui so \
> that makes sense.  But once uic comes out of the inner load, the outer load starts \
> messing up.  It seems that the types have been changed around and so the \
> `isinstance(item, QtWidgets.QWidget)` in `WidgetStack.popWidget()` starts failing.  \
> You can look at the identifiers in the log but even the repr's have been totally \
> changed.  So despite there  certainly being things that uic wants to match in that \
> loop, they don't match. 
> One work around is to manually import the fileview module ahead of time so it's \
> already parsed.  This makes sense with why it works after subsequent loads of the \
> .ui as well.

It wouldn't surprise me at all if nested loads didn't work.

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic