QTreeView: re-use cached values in rowsInserted()
The parentRowCount and the delta were already calculated a few lines up, so don't recalculate them here. This improves performance (rowCount() is a virtual function), as well as readability (delta is more readable than end - begin + 1). Change-Id: Iabe88852a61f7ef52139e1ba446e9d3f87d6bd04 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
This commit is contained in:
parent
045e417eff
commit
af32319803
@ -2568,7 +2568,7 @@ void QTreeView::rowsInserted(const QModelIndex &parent, int start, int end)
|
||||
if (((parentItem != -1) && d->viewItems.at(parentItem).expanded)
|
||||
|| (parent == d->root)) {
|
||||
d->doDelayedItemsLayout();
|
||||
} else if (parentItem != -1 && (d->model->rowCount(parent) == end - start + 1)) {
|
||||
} else if (parentItem != -1 && parentRowCount == delta) {
|
||||
// the parent just went from 0 children to more. update to re-paint the decoration
|
||||
d->viewItems[parentItem].hasChildren = true;
|
||||
viewport()->update();
|
||||
|
Loading…
Reference in New Issue
Block a user