refreshtest example: newbie understanding problems
Hello everyone - thx for reading!
I am working on a plot for an ad-converter. Because I'm new to C++, Qt and Qwt, I am currently studying the refreshtest example to get a clue of how to implement the plot. I think I get most of the code, but the following is not clear to me:
When and by what are these functions called:
Code:
QPointF CircularBuffer
::sample(size_t i
) const {
const int size = d_values.size();
int index = d_startIndex + i;
if ( index >= size )
index -= size;
const double x = i * d_step - d_offset - d_interval;
const double y = d_values.data()[index];
}
QRectF CircularBuffer
::boundingRect() const {
return QRectF(-1.0,
-d_interval,
2.0, d_interval
);
}
Since this is the Qwt forum, I desisted from posting the whole code of the example. I hope thats fine.
Looking forward for your help!
Emi
Re: refreshtest example: newbie understanding problems
Like the name of the class indicates this is a circular buffer with fixed samples, where the start index gets modified by time. It is only for the example - nothing you need to spend your time with.
All you you should have understood is that you can assign arrays of points to a curve or implement a bridge ( like CircularBuffer ) that reads the points from however you need to store your points.
Uwe
Re: refreshtest example: newbie understanding problems
Thanks Uwe!
Quote:
Originally Posted by
Uwe
Like the name of the class indicates this is a circular buffer with fixed samples, where the start index gets modified by time. It is only for the example - nothing you need to spend your time with.
Ok, I think I got this roughly. But for a general understanding it would be nice to know how and when these functions are called. I can't find anything in the code which triggers CircularBuffer::sample(). But if I add qDebug("bla") to the function, I see it is called regularly. Maybe this is basic knowledge, which I didn't stumble over yet!?
I know this might be a question for the newbie forum, but in my first thread about Qwt I was asked to post here next time.
Thank you for your help,
Emi