call void QLayout::removeWidget ( QWidget * widget ) to remove your widget from layout. Then try to delete it. Pay attention to its owner.
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.
Note: The ownership of widget remains the same as when it was added.