I would like to dynamically change the widget displayed in a part of a window. According to the situation, another widget should be displayed.

I have tried to remove the old widget from the layout and add the new one but it does not work.

I have tried to delete the old layout and create a new one but it does not solve the problem.

During these attempts, I have tried to repaint the window but it does not help.

How could I do? I just need to replace dynamically a widget with another one in a "box" of the layout.

Thanks!