Does it also give you "0" when you do the qDebug in side the loop?
And the qDebug() output is printed every time?

Cheers,
_