[SOLVED] Strategy for displaying different forms in same main window
-
As the title says, what is the best strategy to show different forms in the one main window depending on state?
Say that to get to form B, the user must first interact with form A. To that end, I would like to to show form A and, when appropriate, close form A and show form B, all while keeping the menu, tool and status bars in the same one main window (menu and tool bars would have to be updated and items enabled/disabled accordingly).
So far I have only been playing with wizard-generated code and it isn't immediately clear to me if this is possible to achieve (correction: it's Qt so it should be possible!). Would appreciate some help.
-
Hi and welcome to devnet,
Sure it's possible. However you'll have to write the logic a bit. For the widget switching itself a QStackedWidget can contain them. Set that QStackedWidget as central widget of your QMainWindow and you have your starting point.
Hope it helps
-
Thanks for your reply.
QStackedWidget does seem to be what I'm looking for! -I have a question though.-
-I'm not sure if I'm doing it right but I have tried to promote the QWidget class of the wizard-generated MainWindow to QStackedWidget but it won't let me -- "screenshot here":http://www.zimagez.com/zimage/screenshot-230115-170043.php.-
EDIT
Please ignore. I was overcomplicating this when it is a simple matter of adding the "Stacked Widget" in to the Main Window form and then working on the stacked widget's logic.
-
Don't worry, it happens to all of us :)
Happy coding !