summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-04-28 12:07:24 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-04-28 12:13:24 (GMT)
commit49708c6e6ac8e6641b1dfdf3ec2ebf347a8ca98f (patch)
tree4f6dfd2427c130338c41d2d1618ba745e838c979 /src
parent5d6a56fd14cb21d9955c49305993f7b7527a27c6 (diff)
downloadQt-49708c6e6ac8e6641b1dfdf3ec2ebf347a8ca98f.zip
Qt-49708c6e6ac8e6641b1dfdf3ec2ebf347a8ca98f.tar.gz
Qt-49708c6e6ac8e6641b1dfdf3ec2ebf347a8ca98f.tar.bz2
Fix regression in QSelectionModel::rowIntersectsSelection
and QSelectionModel::columnsIntersectsSelection The documentation says "if one is selected" inside the row/column, so we need to look over if we find one which is selected Task-number: 252069 Reviewed-by: Marius Bugge Monsen
Diffstat (limited to 'src')
-rw-r--r--src/gui/itemviews/qitemselectionmodel.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp
index 1a3ae2d..8baefdf 100644
--- a/src/gui/itemviews/qitemselectionmodel.cpp
+++ b/src/gui/itemviews/qitemselectionmodel.cpp
@@ -1313,11 +1313,11 @@ bool QItemSelectionModel::rowIntersectsSelection(int row, const QModelIndex &par
int left = sel.at(i).left();
int right = sel.at(i).right();
if (top <= row && bottom >= row) {
- Qt::ItemFlags leftFlags = d->model->index(row, left, parent).flags();
- Qt::ItemFlags rightFlags = d->model->index(row, right, parent).flags();
- if ((leftFlags & Qt::ItemIsSelectable) && (leftFlags & Qt::ItemIsEnabled)
- && (rightFlags & Qt::ItemIsSelectable) && (rightFlags & Qt::ItemIsEnabled))
- return true;
+ for (int j = left; j <= right; j++) {
+ const Qt::ItemFlags flags = d->model->index(row, j, parent).flags();
+ if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled))
+ return true;
+ }
}
}
@@ -1342,11 +1342,11 @@ bool QItemSelectionModel::columnIntersectsSelection(int column, const QModelInde
int top = sel.at(i).top();
int bottom = sel.at(i).bottom();
if (left <= column && right >= column) {
- Qt::ItemFlags topFlags = d->model->index(top, column, parent).flags();
- Qt::ItemFlags bottomFlags = d->model->index(bottom, column, parent).flags();
- if ((topFlags & Qt::ItemIsSelectable) && (topFlags & Qt::ItemIsEnabled)
- && (bottomFlags & Qt::ItemIsSelectable) && (bottomFlags & Qt::ItemIsEnabled))
- return true;
+ for (int j = top; j <= bottom; j++) {
+ const Qt::ItemFlags flags = d->model->index(j, column, parent).flags();
+ if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled))
+ return true;
+ }
}
}