Reputation: 642
I have following two classes with their UI forms.
Now when I need to go to the mainWindow I click on the push button in loginWindow and a new window pops up that is the mainWindow.
void LoginWindow::on_pbLogin_clicked()
{
MainWindow *mainW = new MainWindow;
mainW->show();
}
What I am trying to have is to get the contents of mainWindow in the loginWindow. I could switch/move to mainWindow from LoginWindow in the same window, without mainWindow creating its own window to show its content and I don't want to use qstackedwidget
Is it possible? if yes, how can I achieve this?
Upvotes: 0
Views: 1358
Reputation: 5207
If we assume that LoginWindow
and MainWindow
are both derived from QMainWindow
(otherwise it wouldn't just be a content switch), then one option other than using a QStackedWidget
would be to have the two form classes derive from QWidget
and use either as the centralWidget
of a single QMainWindow
instance.
Upvotes: 1