Details
-
Suggestion
-
Resolution: Fixed
-
Not Evaluated
-
None
-
6.3.0
-
None
Description
When using a QStyledItemDelegate with a QListView, the sizeHint call is issued for every single item in the list, causing slowdowns when the list is large.
In my test example, I have about 750.000 item.
doBatchedItemLayout calls itemSize 739686 times, The Visual Studio grab shows the state. items is empty and info.last is 739686.
It looks like mouse movement can cause a call to doBatchedItemLayout to be made as well.
sizeHint is about 35% of my performance profile, so reducing the number of calls would help a great deal.
bool QIconModeViewBase::doBatchedItemLayout(const QListViewLayoutInfo &info, int max) { if (info.last >= items.count()) { //first we create the items QStyleOptionViewItem option; initViewItemOption(&option); for (int row = items.count(); row <= info.last; ++row) { QSize size = itemSize(option, modelIndex(row)); QListViewItem item(QRect(0, 0, size.width(), size.height()), row); // default pos items.append(item); } doDynamicLayout(info); } return (batchStartRow > max); // done }
list of about 100,000 items.