Qt: QAbstractItemModel and 'const'

Posted by Eye of Hell on Stack Overflow See other posts from Stack Overflow or by Eye of Hell
Published on 2010-05-17T06:44:40Z Indexed on 2010/05/17 6:50 UTC
Read the original article Hit count: 178

Filed under:

Hello.

I'm trying to use a QTreeView for a first time, with a QAbstractItemModel. And instantly it's a problem: QAbstractItemModel interface declares methods as 'const', assuming they will not change data. But i want a result of SQL query displayed, and returning data for a record with specified indeq REQUIRES to use QSqlQuery::seek() that is a non-const. Is it any 'official' guideline to use a QAbstractItemModel with data that MUST be changed in order to get number of items, data per item etc? Or i must hack C++ with const casts?

© Stack Overflow or respective owner

Related posts about qt