A simple approach for this kind of "dynamic" layout is to keep a QList (or other container) of pointers to Widgets and use those pointers to add/remove from the layout.

//you can code add and remove helper functions that add or remove widget pointer both to layout and to QList.
LE:
the remove function also delete the widget pointer.