title: QT 5.5 embed external application into QWidget
body: <p>I'm interested in embedding an external application inside of my QT 5.5 Widget based application. I'm only concerned with it working on Linux.  I'm using CentOS 7 with GNOME.</p>
  
  <p>This is the code I have tried:</p>
  
  <pre><code>Widget::Widget(QWidget *parent) :
      QWidget(parent),
      ui(new Ui::Widget)
  {
      ui-&gt;setupUi(this);
  
      QWindow *window = QWindow::fromWinId(125829124);
      QWidget *widget = QWidget::createWindowContainer(window);
      widget-&gt;setParent(this);
      QVBoxLayout *layout = new QVBoxLayout();
      layout-&gt;addWidget(widget);
      this-&gt;setLayout(layout);
  }
  </code></pre>
  
  <p>In this example I'm getting the WinId separately and just hard-coding the value for testing.  The application to be embedded is running.</p>
  
  <p>When I execute my Application it runs with no errors.   And the application to be embedded changes screen position and resizes, however it does not embed inside my application.  It is still a separate window.   If I kill my application, the embedded application is killed as well.</p>
  
  <p>So is there a way to actually embed the application inside of my application?  </p>
  
  <p>*************** UPDATE ****************</p>
  
  <p>Something interesting I just uncovered.   When I run my application (container application) the second application (the one I want embedded) remains an independent Window outside of my application.  However if I resize my application window (click the lower right corner to resize the window) the second application (to be embedded) resizes as well, but remains an independent Window outside of my container application.</p>
  
  <p>Even more interesting is that if I kill my application, both applications "disappear" from the desktop.  However System Monitor shows the second application (the one I want embedded) is still running (however with no GUI).  Now if I launch my application again the second application is in fact embedded in my container application, just the way I would like!</p>
  
  <p>So I guess I have to figure out why killing my application and then relaunching it embeds the second application correctly.</p>