[Interest] Taking back a widget from a QBoxLayout?
roland at logikalsolutions.com
Tue Mar 19 01:12:09 CET 2019
Not a troll but willing to take a bit of a stab.
If one is removing a widget from a layout it's generally to reparent it.
You needed to copy the line above the note.
Removes the widget /widget/ from the layout. After this call, it is the
caller's responsibility to give the widget a reasonable geometry or to
put the widget back into a layout.
A widget removed from a layout tends to not have a reliable geometry. If
one is going to delete the widget a better question would be, why bother
removing it. You have the pointer already so just do
On 2/23/19 4:00 AM, interest-request at qt-project.org wrote:
> So addItem parents it as it's own, then removeItem leaves it. No wonder it was crashing. This might be a bug? I don't know why removing it would keep the parent (the layout) then your subsequent call to delete deleted the widget and it's layout, so the parent was left dangling. I would have expected that the parent be nulled out, rather than keep it referencing the layout it had just been added to and removed from. Perhaps a Troll can comment?
Roland Hughes, President
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Interest