qt - Solved - Qt5 QTreeView with custom model and large data very slow scrolling -


i have custom data need display in qtreeview. have derived model qabstracttablemodel, , made own implementations of rowcount(), columncount(), data(), , headerdata(). model has local qlist> support it, , data() function defined read values out of list of lists directly corresponding row , column received in qmodelindex parameter. there 2 issues i'm running into.

the first load of large file quite slow, understandable. second scroll action painfully slow, not understanding. turns out if pull scroll handle down, gui hangs 20 seconds, , pops back. if pull handle greater distance down, hang time increases accordingly. if pull handle way bottom of scroll bar, after waiting application become responsive again, can pull handle , down , better response.

it seems me qtreeview asking small chunk of available data, when have pulled scroll handle way bottom of scroll bar, once application becomes responsive again, has point read data.

is there way program more responsive experience scrolling large data? don't mind longer wait front, forcing view read data model front work.

i have thought go deriving qabstractitemview , controlling how requests , stores data, allowing storing viewed data, plus buffer of entries before , after viewed data. of course mean i'd have control scroll bar, since handle sizing indicate small amount of data, , user should size of data dealing with. not wanting go there if don't have to.

two things:

  • re-implement fetchmore() , canfetchmore() in model. see this implementation example. basically, 2 functions allow lazy initialization of data , should stop ui freezes.
  • replace usage of reset() , datachanged() use insert , remove functionality. right now, forcing view recalc of 100,000 items show.

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -