[Qt-interest] QTableView vs QTreeView

Andre Somers andre at familiesomers.nl
Sat Sep 4 08:46:38 CEST 2010


  Op 3-9-2010 19:41, David Boosalis schreef:
> I am currently using QTreeView to display data as a table.  Why I am 
> using a QTreeView was that when I started the project over a year ago 
> I  did not like how the standard QTableView looked and interacted with 
> the user (Cell focus versus row focus of the QTreeView).  I am looking 
> at ways to increase performance of my windows.  A user might have 20 
> or more of these QTreeView windows open.  Each window getting data 
> from a socket and then doing a resort.  All this sorting and appending 
> of new data on these windows is taking up as much as 50% of the cpu 
> with just ten windows.
> Will I get a significant speed up if I switch to a QTableView.  (I do 
> set the flag on my QTreeView for a uniform size) . There is a 
> Commercial table offered by ICS, that looks really nice.  Does anyone 
> know if this has any speed enhancements to it over a normal QTableView.
>
> Any thoughts on this subject appreciated.
It is a good idea to use a QTableView for tabular data instead of a 
QTreeView. A QTableView can, with a few lines of code, be made to look 
exactly like a table in QTreeView. It really is significantly faster, as 
its layout algorithms are much, much simpler. Unfortunately, QTreeView 
does not support something like QListView::setUniformItemSizes.

André




More information about the Qt-interest-old mailing list