Remove widgets from QVBoxLayout [SOLVED]
-
Dear all
I have some (small) issues with the QVBoxLayout.
I have a list of input lines ordered in a QVBoxLayout. I have buttons to add lines (which works perfectly fine), and buttons to remove lines. When there are only 2 or 3 lines, the lines don't disappear in the widget. They are desactivated, but they remain visible, and overlap with the active lines. Maybe a picture will explain better than me, so here is a screenshot. On the left: the window after adding 3 lines, and on the right, the window after removing 2 lines using the takeAt(int) method.
!http://img28.imageshack.us/img28/4871/screenshotqxm.png(screenshot)!
Is there any way to clean the widget ? I have looked, but I didn't find any clearLyout() method or anything similar. update() of the layout or the widget does not work either.
Thanks for the advice !
Alain
-
That issued was discussed maybe a hundred times here. The thing is, that you should not only remove your widgets from layout, but actually delete them.
-
If you use removeItem() or removeWidget() than you have to delete widget manually. As docs say:
bq. It is the caller's responsibility to delete the item.
-
It indeed works. Thanks a lot !