Hi Everyone,
To my mainwindow, I have added a StackedWidget. In the StackedWidget I have added 3 pages, say, they are:
1)page_Main
2)page_User
3)page_Logs
page_Main is the default page which contains 2 pushbuttons(pB_User and pB_Logs). So the design is such that if I click pB_User, currentWidget changes to page_User and same for pB_Logs.
Now on page_User, I have a pushbutton (pB_BackUser), which when clicked should set the currentWidget to the previous page (i.e page_Main). I can do this easily by the following code:
void MainWindow::on_pB_BackUser_clicked()
{
ui->stackedWidget->setCurrentWidget(ui->page_Main);
}
void MainWindow::on_pB_BackUser_clicked()
{
ui->stackedWidget->setCurrentWidget(ui->page_Main);
}
To copy to clipboard, switch view to plain text mode
But is there any more general way by which I can achieve this? 
I mean some Qt Methods, which when called automatically take you to the previous page or widget? I tried with the following methods like :-
focusNextChild() , focusNextPrevChild() ,focusPreviousChild ()
but without much success. 
I would be really glad if anyone can help me out, please.
With regards,
Sattu
Bookmarks