Not using QSqlQuery, I just looked at this page: http://qt-project.org/doc/qt-4.8/qsqlquery.html
According to that page, you should use the first() function before entering the loop, and rewrite your loop this way:
bool bKeepLooping = qry->first();
while( keepLooping )
{
// do stuff with the query
// get next item at the bottom of the loop
keepLooping = qry->next();
}
I am not a Qt expert. I'm just reading the docs and giving advice on what I believe is the issue. Most iterative approaches to getting "first" and "next" items in a list is done this way (reading files in a directory, getting items in a result set, etc.).