Hello All,
I want to create multi UI screen application using C++ and navigate through it using PushButtons.
Suppose on every screen there are many other objects and Next and Previous PushButtons. When I press the button the respective screen must appear and previous screen must get closed. I have gone through net and found that using QStackWidget this is possible and easy, like:

Qt Code:
  1. QWidget *firstPageWidget = new QWidget;
  2. QWidget *secondPageWidget = new QWidget;
  3. QWidget *thirdPageWidget = new QWidget;
  4.  
  5. QStackedWidget *stackedWidget = new QStackedWidget;
  6. stackedWidget->addWidget(firstPageWidget);
  7. stackedWidget->addWidget(secondPageWidget);
  8. stackedWidget->addWidget(thirdPageWidget);
To copy to clipboard, switch view to plain text mode 


With setCurrentIndex ( int index )

Problem:
I am not getting how to use it, suppose I have 2 UI’s 1. MainWindow.UI and 2. MainWindow2.UI. So how to fit my MainWindow.UI and MainWindow2.UI there.

Can someone please share a simple working project for the same. I am new to QT and so not able to construct from help available on net.

Thanks in Advance
Sahil Kulkarni.