title: How to plot with QwtPlot from Qt slot?
body: <p>Good time of day! I have a question you'll maybe find silly and obvious, but i've already broke my head trying to solve this.</p>
  
  <p>I want to plot some curve by pressing a QPushButton. I wrote the slot and connected it to the corresponding signal of this button. But when I click on it, nothing happens on the plot, although this function executes, and it can be viewed on the debugger and qDebug() output.</p>
  
  <p>On the other hand, if you call this function directly, and not as a slot, it works perfectly. The only difference is the calling method: as a slot in first case and as a method in the second case.</p>
  
  <p>Some code examples:</p>
  
  <pre><code>//Slot 
  void MainWindow::buttonClick()
  {
      qDebug() &lt;&lt; "Enter";
      XRDDataReader *xrdr = new XRDDataReader();
      xrdr-&gt;fromFile("/home/hippi/Документы/Sources/Qt/49-3.xy");
  
      ui-&gt;plot-&gt;plotXRD(xrdr-&gt;xValues(), xrdr-&gt;yValues());
      qDebug() &lt;&lt; "Quit";
  }
  
  void Plotter::plotXRD(QVector&lt;double&gt; x, QVector&lt;double&gt; y)
  {
      QwtPlotCurve *curve = new QwtPlotCurve();
      curve-&gt;setRenderHint
                  ( QwtPlotItem::RenderAntialiased, true );
      curve-&gt;setPen(Qt::black, 2);
  
      curve-&gt;setSamples(x,y);
      curve-&gt;attach(mainPlot);
  }
  </code></pre>