summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels/qitemselectionmodel.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-12-16 07:05:19 +0100
committerLiang Qi <liang.qi@qt.io>2019-12-16 07:05:19 +0100
commitee71a9ba8169b9327b8dbaf2266ebeb515c64dbb (patch)
treea2eb41c9b1b47ac8cd6f22c289f7227569ee0a5a /src/corelib/itemmodels/qitemselectionmodel.cpp
parentd6266c757d2f2ea4ff1e71dc8545f9bf97aa3bb1 (diff)
parent98f19f00361bf25097281cae5dfa833ba7db8a2f (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts: src/network/ssl/qsslsocket.cpp src/widgets/kernel/qapplication.cpp Change-Id: Ib7421cc2df59d0969f89b3fbd65a17ea76ffef3b
Diffstat (limited to 'src/corelib/itemmodels/qitemselectionmodel.cpp')
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp
index f4402c88dc..e4ac5da299 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.cpp
+++ b/src/corelib/itemmodels/qitemselectionmodel.cpp
@@ -1627,10 +1627,9 @@ 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) {
- QItemSelectionRange range = sel.at(i);
+ for (const QItemSelectionRange &range : qAsConst(sel)) {
if (range.parent() != parent)
- return false;
+ return false;
int top = range.top();
int bottom = range.bottom();
int left = range.left();
@@ -1661,11 +1660,13 @@ bool QItemSelectionModel::columnIntersectsSelection(int column, const QModelInde
QItemSelection sel = d->ranges;
sel.merge(d->currentSelection, d->currentCommand);
- for (int i = 0; i < sel.count(); ++i) {
- int left = sel.at(i).left();
- int right = sel.at(i).right();
- int top = sel.at(i).top();
- int bottom = sel.at(i).bottom();
+ for (const QItemSelectionRange &range : qAsConst(sel)) {
+ if (range.parent() != parent)
+ return false;
+ int top = range.top();
+ int bottom = range.bottom();
+ int left = range.left();
+ int right = range.right();
if (left <= column && right >= column) {
for (int j = top; j <= bottom; j++) {
const Qt::ItemFlags flags = d->model->index(j, column, parent).flags();