[Qt-interest] QTreeView and custom QAbstractItemModel performance problem

Felix Brack fb at ltec.ch
Fri Jul 9 17:05:09 CEST 2010


On 09.07.2010 15:55, Mandeep Sandhu wrote:
>> For what I want the TableView is like taking sledgehammer to crack a
>> nut. I just want a protocol, say 200 lines, first column shows an icon
>> and when it's full the oldest data gets discarded.
>
> Sorry for jumping in so late. I've been following your issue for some time.
>
> Initially you had mentioned "...i.e. the model is not hierarchic, all
> rows have the same parent (root) and consist of multiple
> columns..."
>
> In such a case, why did you choose to go for a tree based model and view combo?
>
> If there is no hierarchy in your data (i.e it's flat) wouldn't it be
> easy for you to "flat" model/view combo? (Table model/view as
> Sean/Andre suggested)
>
> I was initially confused thinking you had a tabular data for each
> _level_ in your hierarchy and thats why you were using a tree
> structure. But I guess thats not the case with you.
>
> Regards,
> -mandeep
What I was really looking for is a 'multi column list view' which does 
not exists in Qt except the TableView of course. I already tried to 
explain why I did not use a TableView from beginning. But this might 
need a better explanation.
While looking for my 'multi column list view' in Qt's help a came across 
QListView. The help says:

'This view does not display horizontal or vertical headers; to display a 
list of items with a horizontal header, use QTreeView instead'

Well, I decided to do so. If one really just wants a list view with a 
horizontal header it would perhaps be better to suggest:

'This view does not display horizontal or vertical headers; to display a 
list of items with a horizontal header, use QTableView instead'

I don't blame the folks who wrote the excellent help, far from it! There 
are not many frameworks with such an outstanding documentation. Looking 
at the sentence above: my bee there is a tiny little bit of tuning 
required? Would be nice for dumb (a hard word I know, but I am talking 
about myself here;)) people like me.

Felix



More information about the Qt-interest-old mailing list