What you have coded is the C++ foreach which iterates a list.
Assuming I understand what you are asking ... if you want to do it by index then you can use the
size() operator of the QList Class | Qt Core 6.6.1[
^] to get the number of elements. something like:
for (int index = 0; index < list.size(); ++index)
{
qDebug() << list[index];
}