How to remove a (sub) layout element from a QVBoxLayout?

I found a lot of answers about removing a widget from QVBoxLayout.

But I did not find the answer about deleting the layout. I know that I can put my sub-layout in a QWidget. I just want to know something else.

layout = QtGui.QVBoxLayout() item_in_layout = create_layout() layout.addLayout(item_in_layout) # Remove? 
+6
source share
2 answers

Use removeItem with a pointer to the layout you want to remove.

+4
source

Use QLayout::itemAt to get the corresponding layout element and QLayout::removeItem to remove it.

0
source

Source: https://habr.com/ru/post/946959/


All Articles