title: Controlling Multiple UI files in Qt framework
body: <p><strong>Question asked twice:</strong> see <a href="https://stackoverflow.com/questions/6900147/handling-multiple-ui-files-in-qt">Handling multiple ui files in Qt</a></p>
  
  <p>I am new to Qt framwork , i have been given this simple task:</p>
  
  <p>In the MainWindow , i have a submit button , once its clicked another total different window should appear</p>
  
  <p>i thought of doing this by doing one extra UI file called From.ui file and to switch from MainWindow to Form once submit is clicked , this is my code:</p>
  
  <pre><code>//main.cpp
  #include "mainwindow.h"
  
  #include &lt;QtGui/QApplication&gt;
  
  int main(int argc, char *argv[])
  {
      QApplication app(argc, argv);
  
      MainWindow mainWindow;
      mainWindow.setOrientation(MainWindow::ScreenOrientationAuto);
      mainWindow.showExpanded();
  
  return app.exec();
  }
  
  
  
  //MainWindow.cpp
  #include "mainwindow.h"
  #include "ui_mainwindow.h"
  #include "form.h"
  #include &lt;QtCore/QCoreApplication&gt;
  
  MainWindow::MainWindow(QWidget *parent)
      : QMainWindow(parent), ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
  
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  
  void MainWindow:: SubmitClicked()
  {
      Form* f= new Form(this);
         f-&gt;show();
         f-&gt;raise();
         f-&gt;activateWindow();
  }
  
  
  
  
  //Form.cpp
  #include "form.h"
  #include "ui_form.h"
  
  Form::Form(QWidget *parent) :
      QWidget(parent),
      ui(new Ui::Form)
  {
      ui-&gt;setupUi(this);
  }
  
  Form::~Form()
  {
      delete ui;
  }
  </code></pre>
  
  <p>this code compiled perfectly , but its not doing as expected , once submit is clicked , nothing is done...</p>
  
  <p>can you please tell me whats wrong ?</p>