[PyQt] QMdiArea persistence issue with closed windows

Phil Thompson phil at riverbankcomputing.com
Wed Oct 13 20:30:08 BST 2010


On Wed, 13 Oct 2010 15:44:58 +0200, "Hans-Peter Jansen" <hpj at urpla.net>
wrote:
> Hi Phil,
> 
> while looking at dynamic resizing widgets on irc, David Boddie created a

> small script, that I improved a little bit, which shows a small bug 
> with mdi windows. According to the doc of QMdiArea::addSubWindow, 
> closing windows should stay hidden, but if you close the mdi window, 
> and adds another button, it tracebacks with:
> 
> Traceback (most recent call last):
>   File "dynresize.py", line 29, in addRow
>     if self.subwindow.isHidden():
> RuntimeError: underlying C/C++ object has been deleted

The docs say that a closed window will be hidden if you are passing your
own QMdiSubWindow. It isn't really clear about what happens when you pass a
QWidget. If you look at the C++ implementation of addSubWindow() you see
that it is setting WA_DeleteOnClose in this case. So I think the current
behaviour is correct.

Phil


More information about the PyQt mailing list