Priority: P3: Somewhat important
Affects Version/s: 5.7.0
Fix Version/s: None
Component/s: Widgets: Main Window
Environment:Windows 10, Qt 5.7.0. MSVC 2015
tl;dr - Question: Why isn't there a restoreToolBar akin to restoreDockWidget?
Steps to Reproduce:
- Compile and run attached main.cpp
- Undock/Float Toolbar 2 (TB2 buttons) (& for comparison, undock Dock 2)
- Use toolbar context menu to "hide" Toolbar 2 (& for comparison, Dock 2)
- Click 'View 2' to switch to a view where Toolbar 2 (& Dock 2) don't/shouldn't exist
- Quit the program
- Re-run the program
Expected Results: Toolbar 2 (& Dock 2) hidden. On 'show' from the context menu, they're correctly placed and floating.
Actual Results: Toolbar 2 is visible, when it shouldn't be. (Dock 2 works as expected)
I have tried many attempts to have View-specific display of toolbars, akin to dockwidgets, which works fine. By "View-specific display" I mean, that a given view only has certain widgets available to the user, but we save/maintain the location of all of them for when they are visible. DockWidgets does this fine via restoreDockWidgets. Attempt 2 - currently uncommented and demonstrated above - is clearly poorly written (setHidden(true) forces visible), but there doesn't seem to be a clear solution with toolbars as there is with dock widgets. Happy to solicit alternatives/suggestions for handling this.