summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qtableview.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-05-19 11:04:19 +0200
committerLiang Qi <liang.qi@qt.io>2016-05-19 12:55:27 +0200
commit818014b449ef996099b4795a82f09651cf1c0129 (patch)
tree02f991007097fa368491a81eebbabe4cc162a0e0 /src/widgets/itemviews/qtableview.cpp
parente6cc1d788dddda2998a9f941664ede928ce1e212 (diff)
parent640441882d20f86db05ab5fd1141abe39a0bd409 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: configure src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp src/network/access/qnetworkaccessmanager.cpp src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h src/widgets/widgets/qlineedit_p.cpp src/widgets/widgets/qlineedit_p.h src/winmain/winmain.pro tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp tools/configure/configureapp.cpp Change-Id: Ib9997b0d0f91946e4081d36c0c6b696c5c983b2a
Diffstat (limited to 'src/widgets/itemviews/qtableview.cpp')
-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 e045d60fc8..eebd0de9bb 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -3248,13 +3248,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);
}
}
}
@@ -3288,14 +3287,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);
}
}
}