title: Qt Dialog Window Opens in Same Window
body: <p>I managed to get a QPushButton to open a new window when pressed by using the following code (just snippets of code):</p>
  
  <pre><code>AppDialog::AppDialog(QWidget *parent)
          : QDialog(parent)
  {
      QPushButton *button3 = new QPushButton(tr("Apps"));
      QHBoxLayout *hLayout = new QHBoxLayout;
      hLayout-&gt;addWidget(button3);
      setLayout(hLayout);
  }
  
  
  MainWindow::MainWindow()
  {
  mainMenu = new MainMenu;
  setCentralWidget(mainMenu);
  
  app = 0;
  readSettings();
  }
  
  
  void MainWindow::AppMenu()
  {
      app = new AppDialog(this);
      app-&gt;show();
  }
  </code></pre>
  
  <p>This opens in a new window with an "App" button in it. Can anyone let me know if it's possible and how to open the new app dialog in the same window as the original main menu? It should cover the whole window and look like a normal window with the new menu on it. Ideally after this I could add a "back" button of some sort. I guess this is similar to creating a "wizard" type of interface that is used a lot on the installation wizards and stuff like that.</p>
  
  <p>Bryce</p>
  
  <p>EDIT</p>
  
  <p>This is the source code for implementing QStackedWidgets()</p>
  
  <pre><code>MainMenu::MainMenu(QWidget *parent)
          : QDialog(parent)
  {
      QStackedLayout *stackedLayout = new QStackedLayout;
  
      AppDialog *app = new AppDialog;
      progWidget *program = new ProgWidget;
  
      QStackedWidget *stackedWidget = new QStackedWidget;
      stackedWidget-&gt;addWidget(app);
      stackedWidget-&gt;addWidget(program);
  
      stackedWidget-&gt;setCurrentIndex(0);
  
      QVBoxLayout *vLayout = new QVBoxLayout;
      vLayout-&gt;addWidget(stackedWidget);
  
      setLayout(vLayout);
  }
  </code></pre>
  
  <p>Where would I put the signals and slots to change the index? Imaging that the app and program widgets are just a few widgets with some QPushButtons on them. I can get them to display separately but haven't figure out how to change them yet.</p>