From 302c8687f929ea29beba02a65a52c4507d7ab1c2 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 16 Jun 2009 17:45:20 +0200 Subject: Fixed a bottleneck in itemviews that would ask for an update outside of the boundaries of the viewport. Now we catch this and don't call update. This was a performance regression against 4.4. Task-number: 256183 Reviewed-by: alexis --- src/gui/itemviews/qabstractitemview.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index b3b1cdf..cb0037b 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2902,8 +2902,14 @@ void QAbstractItemView::scrollToBottom() void QAbstractItemView::update(const QModelIndex &index) { Q_D(QAbstractItemView); - if (index.isValid()) - d->viewport->update(visualRect(index)); + if (index.isValid()) { + const QRect rect = visualRect(index); + //this test is important for peformance reason + //For example in dataChanged we simply update all the cells without checking + //it can be a major bottleneck to update rects that aren't even part of the viewport + if (d->viewport->geometry().intersects(rect)) + d->viewport->update(rect); + } } /*! -- cgit v0.12