Switch between different QToolBars
-
Hello everyone,
I wanted to ask what would be recommended approach to switch between different toolbars? I want to make the toolbar dependant on the currently select main tab of the application and show only relevant icons at the moment. I could just create the vectors and call hide and show for specific icons, but maybe there is something cleaner?
Should I maybe try to:
- create multiple toolbars and hide not needed with
QWidget::setVisible(bool)
- or is there maybe a way to pack the icons in the one toolbar in some container (
QStackedWidget
would be desired) and switch between the container pages as required? I can basically add widget toQToolBar
, but still I don't know if it does make sense, because I am not sure how to put the necessary icons inQStackedWidget
pages?
or should I just leave it and try the simplest possible approach with vectors?
I am asking, because maybe there is some clean way of creating paged toolbar and I am just missing it.
- create multiple toolbars and hide not needed with
-
Hi,
Since you have specific actions related to specific tabs, the most clean would be to have one QToolBar per tab and show/hide the toolbar based on the currently shown tab. This will keep things grouped.