And what is switch? Do you mean a switch statement?
Ya. for performing an action corresponding to the item selected.

Why is a stacked widget not possible? You can also try using a stacked layout and create your own stacked widget.
but what to do if there are lot of pages in stackedwidget. memory matters.