summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2014-10-31 17:18:47 +0100
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2014-12-24 22:33:13 +0100
commit62323e8d1b16167662c85e412d35804418593cc6 (patch)
tree8e3379e568e18871e4c832f247172a74e7c011d7 /src
parent87b82fb345a3384243da50240dab93589d072d7e (diff)
QIdentityProxyModel: remove slow bounds-checking, for more performance
If we're called out of bounds, sourceModel()->index() will take care of returning an invalid model index anyway. So calling rowCount+columnCount every time index() is called can be avoided. These calls can be particularly slow when sitting on top of a stack of proxymodels. And index() itself is called very often, i.e. when a proxymodel on top of us is used by a delegate which calls data() for many different roles. Change-Id: I00dd5cf432c0591f41e6fa6fc86c845f29845cd1 (cherry picked from qtbase/3de0f442b5857915f26be6600bc8e54d1af08208) Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/itemviews/qidentityproxymodel.cpp3
1 files changed, 0 insertions, 3 deletions
diff --git a/src/gui/itemviews/qidentityproxymodel.cpp b/src/gui/itemviews/qidentityproxymodel.cpp
index 798873eae2..8e6390159a 100644
--- a/src/gui/itemviews/qidentityproxymodel.cpp
+++ b/src/gui/itemviews/qidentityproxymodel.cpp
@@ -162,11 +162,8 @@ QModelIndex QIdentityProxyModel::index(int row, int column, const QModelIndex& p
{
Q_ASSERT(parent.isValid() ? parent.model() == this : true);
Q_D(const QIdentityProxyModel);
- if (!hasIndex(row, column, parent))
- return QModelIndex();
const QModelIndex sourceParent = mapToSource(parent);
const QModelIndex sourceIndex = d->model->index(row, column, sourceParent);
- Q_ASSERT(sourceIndex.isValid());
return mapFromSource(sourceIndex);
}