GDB/MI (Was: Embedded development)
Roberto Raggi
roberto at kdevelop.org
Wed Sep 14 16:09:07 UTC 2005
Hi Adam,
On Wednesday 14 September 2005 08:50, Adam Treat wrote:
> What do you mean the model doesn't store data? To my mind that is exactly
> what it does? Did you mean that the _view_ doesn't store data? Or do we
> have a problem of communication?
no!! QAbstractItemModel provides _only_ an API to associate data with indexes.
The data are not stored in the model. If you want you can store your data in
the model (like we do in KDevItemModel) but you're not forced to do it(and
actually it's wrong-ish :-).
Suppose you have existing data (e.g. a QStringList). Well.. you don't store
the string list in the model. The thing you do with the QStringListModel is
to describe how "the string at position (i)" is associated with QModelIndex
"index"). This is a pretty cool feature!! Thanks to it we can implement
things like the QProxyModel that takes a model and trasform it into something
else, or KFilterModel (in kdevelop/lib/util) that takes a model and filters
it(of course without duplicating the data)!!!
In general you have
- existing data (e.g. class MyStorage)
- the model that compute the indexes from the data (e.g. MyStorageModel:
QAbstractModel with a reference to MyStorage)
- views and delegates
ciao robe
More information about the KDevelop-devel
mailing list