[Development] QTreeView performance

Иван Комиссаров abbapoh at gmail.com
Fri Jun 8 12:47:27 CEST 2012


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.

However, QTreeView has "int QTreeView::indexRowSizeHint(const QModelIndex & index) const [protected]" function, which is not virtual.
Why QTreeView introduces new  function that returns row size hint, but doen't reimlements "int QAbstractItemView::sizeHintForRow ( int row ) const [virtual]"?

In fact, this virtual function is not reimplemented at all. Is this some architecture requirement, or just a bug (2 functions with same logic, but different implementation)? I can override QAbstractItemView::sizeHintForRow function and in some cases people would be able to achieve big performance boost by reimplementing it.

Ivan


More information about the Development mailing list