you mean by clicking you remove the widget from its parent and create a new one and add it to viewport?
maybe this will help you