QVector is a dynamic generic container, therefore its size will grow to fit the contents.
When you use QVector::reserve(N) it does not mean that you actually have N elements in the vector.
It just means that the object just adjusted its backstore to hold N items( without any items actually being there ). So you must populate the vector after calling reserve(). You can do this by hand or you can use QVector::fill(const &T val, int size). This initializes the first "size" elements of the vector to val, BUT it also resizes the vector to size. So you can use this instead reserve.
Then, you can use QVector::insert(int index, const &T).
Regards
Bookmarks