premroxx
20th September 2011, 03:50
I have a Gui that has few layers/steps. Currently i'm using a stacked widget. When u press next it goes to the next widget. When u press back it goes back to the previous one. Can i make the 'next' & 'back' button common to all widgets ie. i dont want to make a separate 'next' & 'back' button for every single widget
This is the code.
v
oid MainWindow::on_pb_back_clicked()
{
curr = this->ui->stackedWidget->currentIndex();
this->ui->stackedWidget->setCurrentIndex(curr-1);
}
void MainWindow::on_pb_next_clicked()
{
curr = this->ui->stackedWidget->currentIndex();
this->ui->stackedWidget->setCurrentIndex(curr+1);
}
This is the code.
v
oid MainWindow::on_pb_back_clicked()
{
curr = this->ui->stackedWidget->currentIndex();
this->ui->stackedWidget->setCurrentIndex(curr-1);
}
void MainWindow::on_pb_next_clicked()
{
curr = this->ui->stackedWidget->currentIndex();
this->ui->stackedWidget->setCurrentIndex(curr+1);
}