well i got it to finally switch between pages, but I would like it to always open a certain page when you run the app
The code you wrote to change the current page is exactly what you use to set the starting page (in your constructor or elsewhere in your initialisation).
void GUI::on_actionQuit_triggered()
{
ui->actionQuit->triggered(GUI.close()); //<--still doesn't work
}
void GUI::on_actionQuit_triggered()
{
ui->actionQuit->triggered(GUI.close()); //<--still doesn't work
}
To copy to clipboard, switch view to plain text mode
Why did you think it would? You are calling the automatically generated code for a signal from within a slot (automatically) attached to that same signal. I am surprised your program does not implode
Your slot code needs to call something to either close the current QWidget (if it is the last top level window then this usually terminates the app) or explicitly quitting your app.
void GUI::on_actionQuit_triggered()
{
close();
// OR, as Oleg points out
qApp->quit()
}
void GUI::on_actionQuit_triggered()
{
close();
// OR, as Oleg points out
qApp->quit()
}
To copy to clipboard, switch view to plain text mode
Bookmarks