PDA

View Full Version : Access column in QStandardItemModel through its headerData?



homerun4711
22nd February 2011, 10:09
Hello!

I am writing a class to import *.csv files that contain customer related data.

So far I write the data to a QStandardItemModel. The data type (first name, last name, city,...) is used as its headerData. Now I want to add the data to a QSqlTableModel.

Is it possible to access the data in a QStandardModel through its headerData? Something similar to QStringList's


QStringList::indexOf("Street")

to write a nice QSqlQuery like


query.bindValue(":Street", model->data(model->index(row, indexOf("Street"))));

Kind regards,
HomeR