Can someone please help me with a high level explanation of how to trigger multiple forms when centralWidget is used.
I struggle to figure out how to replace one layout with another once centralWidget is set.
My attempt looks something like this: I have a class loginMainWindow, and in the constructor's implementation calls to the functions for creating menus, toolbars, and actions. I also call a function that creates my widget that includes my layout and I set this widget as my centalWidget in this function. Up to this point everything seems to be working.
The problem I'm having is to have an action trigger a different layout/view/form. I created a similar member function as the one for my initial log on page but have no idea what to do with the central widget.
Would appreciate any guidance or other QMainWindow extended applications which have different forms depedent on action listeners.
Thanks, this helps me a lot. For some reason I thought we were not allowed to use dialogs for this exercise.
I tried to changed the layout assigned to the centralWidget every time an action is called.
Just one more question, when you say:
"You don't actually replace anything on the main form - that always stays the same."
does that mean that one and only one layout can be assigned to a centralWidget.
If you create parent-child relationships, how do you manange these layouts specifically in a mainwindow...or dont you
Well firstly - I just assumed that we were meant to use a popup dialog - the question is not very clear about that. It just makes sense to do it that way to me.
I hope thats right though cos I just submitted my assignment haha!.
As for the second question - you can have multiple layouts in the central widget, but they will all show at the same time. The way I understood what you were trying to do, is that you were creating two centralWidgets and just swapping between the two to change the appearance of the main window. I quess this could work (i've never done this so I couldn't say - but it seems to not be unreasonable). I just meant that from my experience you wouldn't want to do this in reality. Imagine if you need to reuse the screen that is on centralWidget number 2 in another application, it would be better to create that screen as a separate class derived from QWidget or some other base class, rather that builtin to a funtion in your MainWindow application.
so it's not that it can't be done - just that it wouldn't make sense to do it in a
real development project.
I hope I understood what u were asking properly though - otherwise just ignore whatever i just said hahaha!!