title: How to set window to active window based on QProcess?
body: <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  #include &lt;QMessageBox&gt;
  #include &lt;QTextStream&gt;
  #include &lt;QTime&gt;
  #include &lt;QProcess&gt;
  
  bool started = false;
  QString path;
  
  MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
      ui-&gt;statusBar-&gt;showMessage("Waiting for input...");
      QFile file("path.txt");
      if(!file.open(QIODevice::ReadOnly)) {
          QMessageBox::information(0, "Error", file.errorString());
      }
      QTextStream in(&amp;file);
      path = in.readLine();
      file.close();
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  
  void MainWindow::on_pushButton_2_clicked()
  {
      qApp-&gt;exit();
  }
  
  void delay(int n)
  {
      QTime dieTime = QTime::currentTime().addSecs(n);
      while(QTime::currentTime() &lt; dieTime)
          QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
  }
  
  void MainWindow::on_pushButton_clicked()
  {
      if(!started) {
          started = true;
  
          qint32 waitSecs = ui-&gt;plainTextEdit-&gt;toPlainText().toInt();
          QTime launchTime = QTime::currentTime().addSecs(waitSecs);
  
          while(waitSecs &gt; 0) {
              waitSecs = QTime::currentTime().secsTo(launchTime);
              ui-&gt;statusBar-&gt;showMessage(QString("Waiting %1 seconds to launch BLR launcher.").arg(waitSecs));
              delay(1);
          }
  
          ui-&gt;statusBar-&gt;showMessage("Launching BLR launcher!");
  
          QProcess *process = new QProcess(this);
          process-&gt;start(path, QStringList() &lt;&lt; "");
      }
  }
  </code></pre>
  
  <p>As you can see from the code above (read the last few lines), I have a process that is started. I want to make sure that the window that starts (by that process) is focused.</p>
  
  <p>I know there is this function: <a href="http://qt-project.org/doc/qt-4.8/qapplication.html#setActiveWindow" rel="nofollow">http://qt-project.org/doc/qt-4.8/qapplication.html#setActiveWindow</a></p>
  
  <p>It requires a QWidget as a parameter. Maybe I need to convert QProcess to Qwidget?</p>