597 if (it->topLeft().parent() != parent) { // Check parents until reaching root or contained in range |
597 if (it->topLeft().parent() != parent) { // Check parents until reaching root or contained in range |
598 QModelIndex itParent = it->topLeft().parent(); |
598 QModelIndex itParent = it->topLeft().parent(); |
599 while (itParent.isValid() && itParent.parent() != parent) |
599 while (itParent.isValid() && itParent.parent() != parent) |
600 itParent = itParent.parent(); |
600 itParent = itParent.parent(); |
601 |
601 |
602 if (parent.isValid() && start <= itParent.row() && itParent.row() <= end) { |
602 if (itParent.isValid() && start <= itParent.row() && itParent.row() <= end) { |
603 deselected.append(*it); |
603 deselected.append(*it); |
604 it = ranges.erase(it); |
604 it = ranges.erase(it); |
605 } else { |
605 } else { |
606 ++it; |
606 ++it; |
607 } |
607 } |
728 void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged() |
728 void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged() |
729 { |
729 { |
730 savedPersistentIndexes.clear(); |
730 savedPersistentIndexes.clear(); |
731 savedPersistentCurrentIndexes.clear(); |
731 savedPersistentCurrentIndexes.clear(); |
732 |
732 |
733 // special case for when all indexes are selected |
733 // optimisation for when all indexes are selected |
|
734 // (only if there is lots of items (1000) because this is not entirely correct) |
734 if (ranges.isEmpty() && currentSelection.count() == 1) { |
735 if (ranges.isEmpty() && currentSelection.count() == 1) { |
735 QItemSelectionRange range = currentSelection.first(); |
736 QItemSelectionRange range = currentSelection.first(); |
736 QModelIndex parent = range.parent(); |
737 QModelIndex parent = range.parent(); |
737 tableRowCount = model->rowCount(parent); |
738 tableRowCount = model->rowCount(parent); |
738 tableColCount = model->columnCount(parent); |
739 tableColCount = model->columnCount(parent); |
739 if (tableRowCount * tableColCount > 100 |
740 if (tableRowCount * tableColCount > 1000 |
740 && range.top() == 0 |
741 && range.top() == 0 |
741 && range.left() == 0 |
742 && range.left() == 0 |
742 && range.bottom() == tableRowCount - 1 |
743 && range.bottom() == tableRowCount - 1 |
743 && range.right() == tableColCount - 1) { |
744 && range.right() == tableColCount - 1) { |
744 tableSelected = true; |
745 tableSelected = true; |