http://doc.qt.io/qt-4.8/qsqltablemodel.html#details
QSqlQueryModel model;
model.setQuery("SELECT * FROM employee");
int salary = model.record(4).value("salary").toInt();
http://doc.qt.io/qt-4.8/qsqltablemodel-members.html
http://doc.qt.io/qt-4.8/qsqlquerymodel.html#record
http://doc.qt.io/qt-4.8/qsqltablemodel.html#rowCount
int second_record_total = model->record(1).value("total").toInt();
or
int row_count = model->rowCount();
int latest_total = model->record(row_count - 1).value("total").toInt();
Hope that helps.