PDA

View Full Version : QTreeView Performance with expandAll and filtering model



teb
2nd November 2010, 13:18
Taking the itemviews/editabletreemodel/* example code and using a larger default.txt file to add way more data and then adding view->setUniformRowHeights(true); and view->expandAll(); leads to a huge delay in showing the initial window. Adding a filter model just kills it. With another test of 300,000 items the filter needed a couple hours to come back. I tried turning QList's into QVector's just to see if that helped.

How do you get QTreeView to display in a responsive manner thousands of simple text data items that are filtered and expanded so the filtering shows?

Thanks in advance.

Here is a Python script to create the default.txt resource file used by the editabletreemodel example:
-------------------------------------------------
f = open('./default.txt', 'w')
for n in range(1, 60000):
t = ""
for m in range(1, 5):
# make-up a name with a random large number ###### and a second column #,#
s = t + "abcdefg" + str(n*m) + "\t"+str(n) +","+str(m)+"\n"
t = t + " "
f.write(s)
f.close()
print "Now run make and restart editabletreemodel"
-------------------------------------------------

teb
2nd November 2010, 21:15
Switching between 4.6.3 and 4.7.0 made a huge difference in the expandAll(). Now looking into the filtering issue. The first time is Qt 4.6.3 and the second timing is Qt 4.7.0:

-------------------------------------
Finish. Time elapsed: 38532ms
-------------------------------------
-------------------------------------
Finish. Time elapsed: 343ms
-------------------------------------

mvidelgauz
31st July 2013, 17:06
I have just found great page (http://stolowski.blogspot.co.il/2009/04/qt4-and-qtreeview-performance.html)about QTreeView performance. Although not directly related to expanding and filtering but 'uniformRowHeights' property has huge performance improvement!