I have an application with the following UI forms deriving from QMainWindow
- LoginWindow
- TasksWindow
- DetailsWindow
I'm supposed to login into the application in the LoginWindow where I will move to the TasksWindow. In the TasksWindow, I will choose an item from a combo box, and then I should move to the DetailsWindow and populate data related to that item. On the DetailsWindow, I will have a menu action to return me back to the TasksWindow.
Currently, what I have in mind (and what I've tried) is this. In the main.cpp:
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
LoginWindow loginWindow;
loginWindow.showMaximized();
return app.exec();
}
And in the LoginWindow push button:
void LoginWindow::on_loginButton_clicked()
{
this->hide(); // hide the login window
TasksWindow tasksWindow;
tasksWindow.showMaximized();
}
is there a better way to do this? It is becoming unmanageable as now I have to include a reference to each window class that I'm supposed to go to, possibly creating circular references!
Note that I'm doing this and compiling the application to be a Qt Symbian application.
What is the best way to switch between application windows? I thought about using a QStackedWidget before, and actually tried it, but the problem then is that I would have to write all the code for handling the different events in the same file and also, the action menus are different across the windows.
Help! :)