Don't call parent() so often when processing a range.

Task-number: QTBUG-17732
Change-Id: Iefe5801f5941136f77001c532870e22f7fdd2c69
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Stephen Kelly 2012-09-26 16:57:38 +02:00 committed by The Qt Project
parent 9b439161ac
commit ebf0ee34e7

View File

@ -294,9 +294,10 @@ QItemSelectionRange QItemSelectionRange::intersected(const QItemSelectionRange &
static void indexesFromRange(const QItemSelectionRange &range, QModelIndexList &result)
{
if (range.isValid() && range.model()) {
const QModelIndex parent = range.parent();
for (int column = range.left(); column <= range.right(); ++column) {
for (int row = range.top(); row <= range.bottom(); ++row) {
QModelIndex index = range.model()->index(row, column, range.parent());
QModelIndex index = range.model()->index(row, column, parent);
Qt::ItemFlags flags = range.model()->flags(index);
if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled))
result.append(index);