Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Loading different classes in same window
I was wondering if there is a way to load different ui in the same MainWindow.
Take for eg . chrome browser . The MainWindow i.e the toolbar , menubar ,etc does not change. Only the data inside the mainwindow changes.
Is there a way to include all classes in one mainwindow and then show different classes on different events in the mainwindow.
The way i know is to add another window and then show that window from the mainwindow.
I hope you got what i'm trying to say.
I don't think stack widgets will help.
I need an entire ui . Not just a widget.
When i click login button in a login form.
The form should load into another form.
The only thing is it should not open a new window.
It should load in the same mainwindow.
So basically you have LoginWidget -> successful login -> PresentationWidget and all in a QMainWindow, right ?
If so you can put both LoginWidget and PresentationWidget in a QStackedWidget and use that QStackedWidget as central widget of your QMainWindow.
Yes exactly ,
The question is how do i put the login widget and presentation widget in QStackedwidget
Where do i declare QStackedwidget and how to include the 2 mainwindows.
Sorry for this but i searched and i'm only getting answers for a single stacked widget.
Because there's no need for two QStackedwidget. Use one in which you put both your other widgets. Also it looks like you are trying to base all your widgets on QMainWindow. Although possible, that usually doesn't make sense.
I just want 1 window with the forms changing for the login and presentation windows.
And then ill use dialog windows after the presentation window.
Anyways thank you. Ill try QStackedWidget.