[Qt-interest] QTreeView and custom QAbstractItemModel performance problem

Felix Brack fb at ltec.ch
Fri Jul 9 15:55:52 CEST 2010


On 09.07.2010 15:24, Sean Harmer wrote:
> On Friday 09 July 2010 14:01:59 Felix Brack wrote:
>> You mean move from TreeView to TableView, right?
>
> No we meant moving to a model that inherits from QAbstractTableModel since
> this takes care of implementing the table-like semantics on top of
> QAbstractItemModel for you.
>
>> I can (and probably
>> will) do that but it's really the last resort. Furthermore when looking
>> at what the TableView can do I will have to switch off about everything.
>> 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.
>>
>> As already stated: I don't think (I might be wrong of course) it is
>> performance problem of any function in the data model (including
>> hasChildren). The problem is the view requesting the same information
>> again and again from the data model. I have been able to prove this with
>> a very stupid data() function in an earlier post.
>> Of course this could be wrong; that would be the case if I missed to
>> implement a function in my data model that stops the view from queering
>> the same values again and again; that function however is not yet known
>> to me.
>
> Hence my request for you to produce a small compilable example that shows the
> issue. We are willing to help you but we do not have time to write test cases
> from scratch. We do not need to see your actual application - just a dummy
> model that does something similar to the model in the app but which does show
> the same symptoms. Ideally the sample app should be of order 200 lines of
> code.
>
> You often find that you stumble upon the problem whilst preparing such
> examples.
>
> Good luck,
>
> Sean
I apologize if it sounded like I would wait for you writing some test 
code for me; this is definitely not what I wanted, sorry.

Felix



More information about the Qt-interest-old mailing list