Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove a (sub) layout item from QVBoxLayout?

Tags:

qt

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

But I didn't find out any answer about removing a layout. I know I can put my sub-layout into a QWidget. I just want to know something more.

layout = QtGui.QVBoxLayout()
item_in_layout = create_layout()
layout.addLayout(item_in_layout)
# Remove?
like image 368
比尔盖子 Avatar asked Jun 10 '13 13:06

比尔盖子


People also ask

How do I delete a layout element?

Select one or more elements in the Layout window. Right-click inside the Layout window and click Delete. The element is removed from the page layout and the Layout window.

How do I remove a widget from Qt?

Removing widgets from layout We use convenient function removeWidget() from Qt for the purpose. First, we get the item at index 0 in the grid using itemAt(0) then after we can remove it from the layout using removeItem() .

What is a QLayoutItem?

The QLayoutItem class provides an abstract item that a QLayout manipulates. This is used by custom layouts. Pure virtual functions are provided to return information about the layout, including, sizeHint(), minimumSize(), maximumSize() and expanding().


1 Answers

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

like image 184
Zlatomir Avatar answered Oct 29 '22 14:10

Zlatomir