If we get data from an SQL database using the following QT functionality

Qt Code:
  1. model->setQuery("SELECT name, salary FROM employee");
To copy to clipboard, switch view to plain text mode 

it states in the accompanying material we can access individual elements using either of the following commands

Qt Code:
  1. int salary = model.record(4).value("salary").toInt();
To copy to clipboard, switch view to plain text mode 

or

Qt Code:
  1. int salary = model.data(model.index(4, 2)).toInt();
To copy to clipboard, switch view to plain text mode 

and that we can insert this data into a QTableView using

Qt Code:
  1. QTableView *view = new QTableView;
  2. view->setModel(model);
To copy to clipboard, switch view to plain text mode 

And that this data can also be However, I can see anywhere how to extract a whole column of data or range of columns / rows (or as in the terminology of QSqlQueryModel index & roles).

Ultimately what I would like to do is efficiently extract parts of the data into either QVectors e.g column 3 of the data. or possibly into a matrix library such as armadillo or Eigen using some sort of getDataFunc(QVector rows, QVector columns).

The data I am working is can be huge, so efficiently is important and thus using a naive set of for loops seems a very bad idea.

Any help much appreciated.