[Qt-interest] Need some practical advicehere... model/view framework

Sean Harmer sean.harmer at maps-technology.com
Fri Jul 3 00:08:07 CEST 2009


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). 
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.

Regards,

Sean




More information about the Qt-interest-old mailing list