PDA

View Full Version : Delete content widget in layout



Hogwarts
17th December 2010, 17:01
Hi
I'm trying to delete a widget or several widgets content in a QBoxLayout. How can I do this?

This is my code:


void CustomRadioButton::deleteOption(int pos)
{
if(pos >= 0 && pos < getLayout()->count())
{
delete getLayout()->takeAt(pos);
update();
}
}

I think I managed to delete the widget, but the layout do not updated visually. Any idea??
Thanks in advanced and excuse my English.

Everall
17th December 2010, 17:59
from the docs :
http://doc.qt.nokia.com/4.7/qboxlayout.html

QBoxLayout Class Reference says :

To remove a widget from a layout, call removeWidget(). Calling QWidget::hide() on a widget also effectively removes the widget from the layout until QWidget::show() is called.

So it's there already.

Have fun.

everall