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