Qt: QAbstractItemModel and 'const'
I am trying to use QTreeView for the first time with QAbstractItemModel and have a problem instantly. The QAbstractItemModel interface declares methods as const
, assuming they will not modify data. But I want the result of the SQL query to be displayed, and to return data for the record at the specified index requires the use of QSqlQuery :: seek (), which is not a constant. Are there any "official" guidelines for using QAbstractItemModel with data that needs to be modified to get the count of items, data per item, etc.? Or should I hack C ++ with const cast?
+2
a source to share