[Qt-interest] QTableView::addColumn()
Neel Basu
neel.basu.z at gmail.com
Sat Dec 20 13:17:28 CET 2008
On Saturday 20 Dec 2008 5:05:03 pm Sebastian Fischer wrote:
> on 20.12.2008 at 10:50 you wrote:
> > Why there is no suchmethod like QTableView::addColumn() ?
> > in Model View architecture some data maynot come from model.
> > may be a check box or a edit button or a total, avg column that are
> > calculated by the data from other columns.
>
> That would be exactly something the model would do. If you want this
> just return +1 columns form the model (in case it's a custom model)
> and do your calculations there. If you have some other base model
> (like SQL or FileSystem and so on) create a simple proxy model that
> doesn't do anything but add that column (or allow users to dynamically
> add various sorts of sum columns and other stuff).
Model means it delivers concrete data.
when you are making a table suppose a marksheet table marks of subjects of
different students are the concrete values
Total and avg are for representation and they are not going to take any place
on record or storage.
so they should not come from model.
> As the name 'View' suggests, it doesn't do anything but show you
> content (and maybe let you edit it). Data storage / calculations
> should be done where the data belongs, in the model.
>
> > all this columns are not a part of model so there should be an
> > addColumn() method on view also so that data that are not coming from
> > model would not have any relation with model
> >
why would there be a representation specific overhead on model ??
When you are isolating view for representation all representation specific
things should go in View.
Both model and view might have calculation overhead.
but Model's calculation overhead should be limited to storage specific it
might also deal with data to deliver something else by conditional checking.
But it should never **CARE** for presentation layer.cause people can plug the
same model into different views where the are viewing the **SAME THING(model
data)** from different aspects/angles. and its not possible for a model to
forsee all this aspects/angles.
and view layer should always deal only with representation part and it should
be able to do calculations specific to representation.
Thank You
More information about the Qt-interest-old
mailing list