I am having an issue using a QSlider to update a qwt plot. Essentially data is stored in a 2D vector (chan1data_p). When the slider moves the plot should replot the data in the given row of the 2D vector. The slider and qwt plot are placed in widget class where the curve 'chan1' is attached to the plot. When the program is run the first row of the vector is plotted but moving the slider has no effect on reploting. When I call updatePlots as a function the plot replots correctly. I checked the signal emited from the slider to make sure I set up the parameters for it correctly so that is not the problem. Anyone have any ideas?


Qt Code:
  1. private:
  2.  
  3. vector<double> ranges_p;
  4. vector<vector<double> > chan1data_p, chan2data_p;
  5.  
  6. QVBoxLayout *layout;
  7.  
  8.  
  9. QwtPlot *profilePlot;
  10. QwtPlotCurve *chan1;
  11.  
  12.  
  13. public slots:
  14. void updatePlots(int profile);
  15.  
  16. protected slots:
  17. void setProfile(int value);
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. void graphPage::updatePlots(int profile)
  2. {
  3. vector<double> tempchan1,tempchan2;
  4. int profile_index;
  5.  
  6. profile_index=profile-1;
  7.  
  8. if(profile<=chan1data_p.size() && !chan1data_p.at(profile_index).empty())
  9. tempchan1=chan1data_p[profile_index];
  10.  
  11.  
  12.  
  13. if(!tempchan1.empty())
  14. chan1->setData(&ranges_p[0],&tempchan1[0], ranges_p.size());
  15.  
  16.  
  17.  
  18. profilePlot->replot();
  19.  
  20.  
  21. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. connect(profileSlider,SIGNAL(valueChanged(int)),SLOT(updatePlots(int)));
To copy to clipboard, switch view to plain text mode