[Interest] Taking back a widget from a QBoxLayout?

René J.V. Bertin rjvbertin at gmail.com
Fri Feb 22 19:04:58 CET 2019

On Friday February 22 2019 17:45:05 Jason H wrote:

>I am not 100% sure, it's been a while, but I would assume that the layout is not the true parent, combined is.

The docs aren't exactly clear on this subject, at least not with the sort of reading glasses I usually have on when I don't exactly want to be reading them ;)

>The "delete combined" will delete child widgets a and b.

That much is clear, because it takes ownership of the layout (THAT is clearly documented).

>You need to unparent them, then delete combined. Layouts allocate pixels and resize things, they don't own them, AFAIK.

Setting their parent back to what it was (nullptr) did the trick indeed, regardless of who really owned them.

I guess I didn't try this yet because I'm never certain if taking ownership is really only done through making yourself a parent.

(Hmmm... "Nooooooooooooooooooooooooooo!" :D --->)


More information about the Interest mailing list