title: Embed gnuplot inside existing QtWidget
body: <p>I am creating a (pseudo) real-time plotting application in C++, using gnuplot as my backend for plotting. One of my requirements is that the plot must be inside an existing window, instead of having a separate plot window (which gnuplot defaults to).</p>
  
  <p>Gnuplot has an option to specify the (Qt) widget ID which seems like this would fit my use case:</p>
  
  <pre><code>set terminal qt widget &lt;id&gt;
  </code></pre>
  
  <p>I tried passing the value inside my <code>QtWidget::effectiveWinId()</code> to no avail. </p>
  
  <p><em>Update</em>: Tried using the internal value of the window id <code>QtWidget::winId()</code> with no luck as well.</p>
  
  <p><strong>The problem is that I cannot find any documentation on what <code>&lt;id&gt;</code> is supposed to be.  Is this what the developers of gnuplot intended?</strong></p>
  
  <p>Here's an example of my code:</p>
  
  <pre><code>#include &lt;QtWidgets/QApplication&gt;
  #include &lt;QtWidgets/QWidget&gt;
  #include &lt;QtNetwork/QLocalSocket&gt;
  
  int main()
  {
      QApplication app(argc, argv);
      QWidget win(nullptr, Qt::Window);
      QWidget *window = win.window();
      win.show();
      std::cout &lt;&lt; "effective win id: " &lt;&lt; window-&gt;effectiveWinId() &lt;&lt; "\n";
      std::cout &lt;&lt; "effective win id: " &lt;&lt; win.effectiveWinId() &lt;&lt; "\n";
      return app.exec();
  }
  </code></pre>
  
  <p>In gnuplot:</p>
  
  <pre><code>gnuplot&gt; set term qt widget &lt;value from effectiveWinId&gt;
  gnuplot&gt; plot x
  Could not connect to existing qt widget. Starting a new one.
  </code></pre>