summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-05-20 13:46:21 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-05-23 21:09:46 +0200
commit56d6e000f7487c59172330ebd23a718268c508f1 (patch)
tree1494432583b1569816075091a8075b31d795f77c /src/widgets/itemviews
parent9fd407fc6a29c94b4568dd042a05c208255179e0 (diff)
parentc276aa51303b7c6f8e4cd854aadf8344a906e50f (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: mkspecs/wince80colibri-armv7-msvc2012/qmake.conf qmake/generators/win32/msvc_vcproj.cpp src/corelib/global/qnamespace.h src/corelib/global/qnamespace.qdoc src/corelib/io/qfsfileengine_win.cpp src/corelib/tools/tools.pri src/network/ssl/qsslconfiguration_p.h src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp src/plugins/platforms/windows/windows.pri src/src.pro src/tools/bootstrap/bootstrap.pro src/tools/uic/cpp/cppwriteinitialization.cpp src/widgets/dialogs/qfilesystemmodel.cpp tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt Change-Id: I4d2ac78f0dcc97f008186bbbc769c6fe588ab0e5
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r--src/widgets/itemviews/qtableview.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index ff3832e499..c7cc1d155e 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -3247,13 +3247,12 @@ void QTableViewPrivate::selectRow(int row, bool anchor)
command |= QItemSelectionModel::Current;
}
- QModelIndex tl = model->index(qMin(rowSectionAnchor, row), logicalColumn(0), root);
- QModelIndex br = model->index(qMax(rowSectionAnchor, row), logicalColumn(model->columnCount(root) - 1), root);
- if ((verticalHeader->sectionsMoved() && tl.row() != br.row())
- || horizontalHeader->sectionsMoved()) {
- q->setSelection(q->visualRect(tl)|q->visualRect(br), command);
+ QModelIndex upper = model->index(qMin(rowSectionAnchor, row), column, root);
+ QModelIndex lower = model->index(qMax(rowSectionAnchor, row), column, root);
+ if ((verticalHeader->sectionsMoved() && upper.row() != lower.row())) {
+ q->setSelection(q->visualRect(upper) | q->visualRect(lower), command | QItemSelectionModel::Rows);
} else {
- selectionModel->select(QItemSelection(tl, br), command);
+ selectionModel->select(QItemSelection(upper, lower), command | QItemSelectionModel::Rows);
}
}
}
@@ -3287,14 +3286,12 @@ void QTableViewPrivate::selectColumn(int column, bool anchor)
command |= QItemSelectionModel::Current;
}
- QModelIndex tl = model->index(logicalRow(0), qMin(columnSectionAnchor, column), root);
- QModelIndex br = model->index(logicalRow(model->rowCount(root) - 1),
- qMax(columnSectionAnchor, column), root);
- if ((horizontalHeader->sectionsMoved() && tl.column() != br.column())
- || verticalHeader->sectionsMoved()) {
- q->setSelection(q->visualRect(tl)|q->visualRect(br), command);
+ QModelIndex left = model->index(row, qMin(columnSectionAnchor, column), root);
+ QModelIndex right = model->index(row, qMax(columnSectionAnchor, column), root);
+ if ((horizontalHeader->sectionsMoved() && left.column() != right.column())) {
+ q->setSelection(q->visualRect(left) | q->visualRect(right), command | QItemSelectionModel::Columns);
} else {
- selectionModel->select(QItemSelection(tl, br), command);
+ selectionModel->select(QItemSelection(left, right), command | QItemSelectionModel::Columns);
}
}
}