PDA

View Full Version : setting UserRole data in QSqlTableModel



orgads
2nd June 2008, 09:29
Hello,

I'd like to set additional data for a table I acquire from an SQL server.

Looking at the code of QSqlTableModel::setData(), it looks like it just ignores any role other than EditRole (it passes it to QSqlQueryModel, down to QAbstractItemModel, which does nothing).

Is there any other way to set data for individual cells in the model?

Thanks.

wysota
2nd June 2008, 09:40
You can subclass the model and implement it yourself or use some kind of proxy model that would hold the additional data. SQL models only operate on the "displayable" data.