[Qt-interest] QTableView::addColumn()

Greg Beauchesne greg_b at vision-play.com
Mon Dec 22 17:48:51 CET 2008


Neel Basu wrote:

> Your Idea of Proxy Model is good. but If I do it in that way there would be an unnecessary calculation overhead
> on Model which can also be done by View.

I'm not sure what you mean by "unnecessary calculation overhead on the
model instead of the view." You can write your proxy model to cache your
calculations if you're concerned about performance. Unless you meant the
 overhead of an extra virtual function call, but I think that's probably
negligible in this case.

> However I've noticed that <Qt3 had addColumn() functions on Views thats why I was saying that they shouldalso be present in Q4
> cause different people can entertain their different tastes.

I came into Qt at version 4, but my understanding is that Qt 3's views
have become the QListWidget/QTreeWidget/QTableWidget classes, and are
essentially (though not exactly) a view and QStandardItemModel wrapped
into one.

If you're dead-set on doing it that way but still want to have your own
base item model, you'll still need a proxy model, but you can make a
generic proxy model that allows the addition of arbitrary columns to any
other model and use that proxy for your views.



More information about the Qt-interest-old mailing list