What if you just delete the respective other groupbox widget?

Also you should probably check if the widget you are creating already exists, e.g. if the same button is clicked twice.

But what you should really consider is to put a QStackedWidget into cell 1,0 and use those two groupboxes as it pages.

Cheers,
_