[Qt-interest] QTableView::addColumn()

Sebastian Fischer creat at gmx.net
Sat Dec 20 12:35:03 CET 2008


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

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

> Do you all agree with me ?? or am I wrong ??

No, I really don't agree, sorry :)

Bye,
Sebastian Fischer







More information about the Qt-interest-old mailing list