You can use QSqlQuery::value(int index) to get the value of field index in the current record.
Qt Code:
query.exec("SELECT ...."); query.next(); qDebug() << query.value(0).toInt() << query.value(1).toString(); // just an exampleTo copy to clipboard, switch view to plain text mode
Bookmarks