2

I have a requirement where I have QAbstractListModel which is being updated continuously. The data type of QAbstractListModel is integar type.

I would like to copy the whole data at particular intervals into the vector so that vector is updated continuously and I can use it further.

Any idea how can I iterate QAbstractListModel by its index and copy it into vector.

1 Answer 1

5

Quick and dirty way of doing it :

QAbstractListModel m; QVector<int> v; const int nbRow = m.rowCount(); v.reserve(nbRow); for (int i = 0; i < nbRow; ++i) { int myInt = m.index(i, 0).data().toInt(); v.append(myInt); } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.