remove item from layout

C++
QLayoutItem* item;
while ( ( item = layout->takeAt( 0 ) ) != NULL )
{
    delete item->widget();
    delete item;
}
delete m_view->layout();
Source

Also in C++: