From e5b32fbe0efc8b6b688374fde3fc1c01fe685d98 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 5673019..c3d1bf7 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2901,8 +2901,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