[Development] QTreeView performance

Иван Комиссаров abbapoh at gmail.com
Fri Jun 8 20:04:28 CEST 2012


Girish, sry, wrong reply.

In setUniformRowHeights mode QTreeView sttill calculates ALL heights, but chooses maximum among them as a row height.

So, possible solutions for huge speedup : 

1) make "int QTreeView::indexRowSizeHint(const QModelIndex &index) const" virtual. This will allow to user to reimplement this function to calculate height easier (return constant or ignore editors size hints). Breaks binary compatibility, but requires just adding "virtual" keyword

2) implement "int QTreeView::indexRowSizeHint(const QModelIndex &index) const" using "virtual int sizeHintForRow(int row) const;" This requires converting QModelIndex into visible row (which is slow) and vice versa (which is fast - there's a list of indexes for rows)

3) add "int fixedheight" property for a tree view, so tree view will use it instead of maximum among row heigths in "setUniformRowHeights" mode.


08.06.2012, в 19:00, Girish Ramakrishnan написал(а):

Hi,

On Fri, Jun 8, 2012 at 3:47 AM, Иван Комиссаров <abbapoh at gmail.com> wrote:
> QTreeView is very slow when inserting big amount of data. In some cases, it is possible to achieve big speedup in case of wixed-height treeviews.
> 
> I.e., in QTreeView calculating of item height is very slow. If we have fixed height (fixed font, no editors), we can not calculate this height, but return constant.
> 

QTreeView::setUniformRowHeights does exactly that.

Girish

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120608/148ca689/attachment.html>


More information about the Development mailing list