[Qt-interest] Need somepractical advicehere... model/view framework
Patric
userqt at gmail.com
Fri Jul 3 00:29:13 CEST 2009
Can't I use directly the QStandartItemModel for my purpose ?
Isn't it easier ?
----- Original Message -----
From: "Kaleb Pederson" <kaleb.pederson at gmail.com>
To: <qt-interest at trolltech.com>
Sent: Friday, July 03, 2009 1:22 AM
Subject: Re: [Qt-interest] Need somepractical advicehere... model/view
framework
> On Thursday 02 July 2009 03:08:07 pm Sean Harmer wrote:
>> Patric wrote:
>> > Thank you guys,
>> > and why to use the QStandartItemModel instead of QStringListModel ?
>> > Because
>> > I want to fill the rows with strings, a far as I know QStandatItemModel
>> > is
>> > for more complex objects ?
>> >
>> You said yourself that your data is tabular in format, hence derive from
>> QAbstractTableModel seems logical to me. The underlying data structure
>> that you choose is up to you. I find it helpful to think of the model
>> classes as merely providing an interface that the views use to
>> communicate with your app about your data (and potentially modify it).
>
> I'm pretty much of the same opinion. I've found that it works very well
> to create a domain model of the system without any regard for what the
> QAbstractItemModel needs. Once I have a valid and well-functioning domain
> model, it doesn't take very long to create an adapter between that and the
> QAbstractItemModel (or appropriate subclass).
>
> This allows you to ignore all the model-view specifics when working on the
> (domain) model and lends itself to a richer vocabulary.
>
> --Kaleb
>
>> The implementation can be hidden behind the model class interface in any
>> way you see fit and of course you are free to update your data
>> structures in other ways as long as you remember to inform the model
>> about the changes so that it can in turn let any other proxy models and
>> views know about the changes.
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
More information about the Qt-interest-old
mailing list