title: PopUP Window in Qt
body: <p>I am creating an application in Qt and I have a problem. I have a main window and I want that when I push a button, a popup window appears. I dont know how can I do it. I tried to call the show() method when I push the button but dont work. I think that I must use the exec() method from QApplication but I dont know how can call it if I created it in the main class.</p>
  
  <p>My classes: </p>
  
  <pre><code>#include "mainwindow.h"
  #include "dialog.h"
  #include &lt;QApplication&gt;
  #include "popup1.h"
  
  int main(int argc, char *argv[])
  {
  QApplication a(argc, argv);
  MainWindow w;
  w.show();
  
  return a.exec();
  }
  </code></pre>
  
  <p>MainWindow:   </p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  #include &lt;iostream&gt;
  #include &lt;QApplication&gt;
  int posiciones[10];
  std::string port="";
  MainWindow::MainWindow(QWidget *parent) :
  QMainWindow(parent),
  ui(new Ui::MainWindow)
  {
  for (int i=1; i&lt;10; i++){
      if(i==7){
          posiciones[i]=90;
      }
      posiciones[i]=0;
  }
  //Mandar el vector para mover
  ui-&gt;setupUi(this);
  }
  
  MainWindow::~MainWindow()
  {
  delete ui;
  }
  </code></pre>
  
  <p>PopUp:</p>
  
  <pre><code>#include "popup1.h"
  #include "ui_popup1.h"
  
  Popup1::Popup1(QWidget *parent) :
  QDialog(parent),
  ui(new Ui::Popup1)
  {
  ui-&gt;setupUi(this);
  }
  
  Popup1::~Popup1()
  {
  delete ui;
  }
  </code></pre>
  
  <p>Anyone knows how can I show the popup window? Thanks for your time.</p>