Hi,
Just a little bit of context:
I am using 3 distinct qwtPlot that use the same data, the data is stored in multiple QVector<QPointF> in each qwtPot, (used to reprensent realtime QwtPlotCurve for each qwtPlot)
To get a little bit what I mean, here is a video of the software in action :
https://www.youtube.com/watch?v=NSCTaG57ze4 (fast foward to the middle)
Now I want to change that, since using 3 times the same data uses a lot memory and is not efficient.
I am trying to change the code so that I have only one place where all the data is stored, and the graph feeds on this data to display new contents when it arrives (with signal/slots mechanism)
So my center class with the data is called "DataWorkout" and contains
- QVector<QPointF> cadenceSamples;
this Samples get filled every second with ~ 4 new QPointF
When I get a new QPoint, this class emit a signal to the qwtPlot class so that they replot the QwtPlotCurve.
Here is the current code used that works
connect(dataWorkout, SIGNAL(newCadenceDataAdded(QVector<QPointF>)), ui->widget_workoutPlot, SLOT(refreshCadenceCurve(QVector<QPointF>)) );
void WorkoutPlot::refreshCadenceCurve(QVector<QPointF> cadenceSample)
{
cadenceCurve->setSamples(cadenceSample);
cadenceCurve->attach(this);
}
connect(dataWorkout, SIGNAL(newCadenceDataAdded(QVector<QPointF>)), ui->widget_workoutPlot, SLOT(refreshCadenceCurve(QVector<QPointF>)) );
void WorkoutPlot::refreshCadenceCurve(QVector<QPointF> cadenceSample)
{
cadenceCurve->setSamples(cadenceSample);
cadenceCurve->attach(this);
}
To copy to clipboard, switch view to plain text mode
My question is: is passing a QVector<QPointF> in a signal/slot going to use a lot of ressource? Will it copy the entire QVector or just pass the pointer/address? I'm not sure the way I used is good but I couldn't find a way without passing the QVector in the signal/slot, because to curve doesn't get display if I don't use .setSamples and .attach on each call.
Thanks in advance / Merci beaucoup!
Bookmarks