I would like to "merge" two QVector of the same size into one third QVector. Example:
// fill both x and y with the same number of items
QVector<QPointF> pos; // composed of x and y values
How to achieve that?
Do you mean something like
Exactly, but I'm looking for something better than the trivial method - if exists.
I'm not in a position to test this, but as a quick response, I think you can use the +=, or the the + operator or possibly the append() method.
What do you mean by better ?
I'd like to avoid cycling over all the elements.
Then how would you create a new object of a different class that uses one element of both vectors ?
Well, the final goal is to easily handle a progressive graph.
I'm using qwt and the qwtdataseries class requires a QVector<QPointF>.
I was going to create a "constant" (I mean I won't change its values) QVector for x axis: 0..1..2..3..4 and so on.
The y QVector will be instead pushed and popped every sample received.
In this way I easily create a scrolling graph in real-time.