summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-06-16 17:45:20 +0200
committerThierry Bastian <thierry.bastian@nokia.com>2009-06-17 10:14:01 +0200
commite5b32fbe0efc8b6b688374fde3fc1c01fe685d98 (patch)
tree489bfc21bc955927485ca052bdbccc9b3c4e3cf6 /src/gui/itemviews
parenteb80cebd25020e26f9f4d0111f53f2246c503194 (diff)
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
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 56730194ae..c3d1bf7daf 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);
+ }
}
/*!