Yes, that is the way it should work.
You can hide also anything based on QWidget Sometimes you have more than one possibility. So there is also some redundancy.
Hi and welcome to devnet,
Add a slot in the widget containing the toolbar and connect QStackedWidget::currentChanged to it. In the slot check the index value and enable/disable the button.
Hope it helps