[Qt-interest] QTreeView and custom QAbstractItemModel performance problem

Sean Harmer sean.harmer at maps-technology.com
Fri Jul 9 16:54:36 CEST 2010


On Friday 09 July 2010 15:41:57 Felix Brack wrote: 
> That sounds like a very good explanation for what I am experiencing and
> what the profiler reports. It really seems that using a TreeView to do
> this was simply a wrong decision of mine. With this explanetion I think
> I can safely (with respect to learning about Qt's framework) discard my
> code and give the TableView a try. I will let you know about the outcome.
> 

I think that you may be misunderstanding us. We are not saying to ditch the 
Model/View architecture. Instead we are simply saying to make your model 
derive from the most appropriate model ie QAbstractTableModel. This will 
simplify your model code and remove the possibility of a number of mistakes 
creeping in that way. QAbstractTableModel simply fills in some of the virtual 
functions of QAbstractItemModel to implement tabular semantics.

There is no reason why you cannot continue to use QTreeView with a model 
derived from QAbstractTableModel.

Sean



More information about the Qt-interest-old mailing list