Making a widget visible while editing but invisible in operation or an alternative solution?

I have a switch which controls a stack of widgets. Each button in the switch makes a different widget appear. The switch is over a row of text widgets, each one reflecting the state of one widget in the stack. To make the interface more ergonomic, the positions of the text modules match those of the switch’s buttons and the switch is made transparent.

However it is not safe to have a widget totally transparent when there any way to keep the border opaque while having all the space inside transparent?

No, but you can always see the widget in its parent’s children list.