summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2012-08-10 18:30:19 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-10 22:02:11 +0200
commitc1df856d6b7fbbf3f21e294cdb481aeaec8110e4 (patch)
tree476213367e49bf6a23f6d43ede8e5ccb9356bd2a /src/corelib
parent4fa544c8cd28907958e2f18e960d54ce0e0770d9 (diff)
Make rowIntersectsSelection take account of the parent argument.
Task-number: QTBUG-22370 Change-Id: I497194793eab624b760deea93dac0df767850330 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp
index 9cc9502577..a7aa404f8c 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.cpp
+++ b/src/corelib/itemmodels/qitemselectionmodel.cpp
@@ -1379,10 +1379,13 @@ bool QItemSelectionModel::rowIntersectsSelection(int row, const QModelIndex &par
QItemSelection sel = d->ranges;
sel.merge(d->currentSelection, d->currentCommand);
for (int i = 0; i < sel.count(); ++i) {
- int top = sel.at(i).top();
- int bottom = sel.at(i).bottom();
- int left = sel.at(i).left();
- int right = sel.at(i).right();
+ QItemSelectionRange range = sel.at(i);
+ if (range.parent() != parent)
+ return false;
+ int top = range.top();
+ int bottom = range.bottom();
+ int left = range.left();
+ int right = range.right();
if (top <= row && bottom >= row) {
for (int j = left; j <= right; j++) {
const Qt::ItemFlags flags = d->model->index(row, j, parent).flags();