diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-06-16 15:45:20 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-06-16 15:49:12 (GMT) |
commit | 302c8687f929ea29beba02a65a52c4507d7ab1c2 (patch) | |
tree | 40be5228efd79b6f5d8e825ab1de04bfb144921f /src | |
parent | 45d48b63135c5e59e5be57986e2355e0c1f41b70 (diff) | |
download | Qt-302c8687f929ea29beba02a65a52c4507d7ab1c2.zip Qt-302c8687f929ea29beba02a65a52c4507d7ab1c2.tar.gz Qt-302c8687f929ea29beba02a65a52c4507d7ab1c2.tar.bz2 |
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')
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 10 |
1 files 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); + } } /*! |