summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qheaderview.cpp
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@theqtcompany.com>2014-10-23 10:30:39 +0200
committerThorbjørn Lund Martsum <tmartsum@gmail.com>2014-11-29 15:21:48 +0100
commitf9408317e70bc2e635a2f9baeff35d1c06227734 (patch)
tree27c91a72faee001c62e9ded59b88666733502e40 /src/widgets/itemviews/qheaderview.cpp
parent62bf16d99278374d54670691ea0cdcd562f00ecf (diff)
Auto-scroll while selecting entire rows/columns did not work
If you press and hold a section in a header view you can extend the selection to more rows by moving the mouse. This worked fine until you moved the mouse outside the geometry of the header view. The expected behavior was then to scroll the view (this is what happens with extended selections on regular table cells). [ChangeLog][QtWidgets][QHeaderView] Auto-scroll the view when making extended row/column selections. Change-Id: Ic65aa34d370e74054b2123ab57edb1add0e8adb9 Task-number: QTBUG-21201 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Diffstat (limited to 'src/widgets/itemviews/qheaderview.cpp')
-rw-r--r--src/widgets/itemviews/qheaderview.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index b609134322..df61441800 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -2371,7 +2371,7 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e)
{
Q_D(QHeaderView);
int pos = d->orientation == Qt::Horizontal ? e->x() : e->y();
- if (pos < 0)
+ if (pos < 0 && d->state != QHeaderViewPrivate::SelectSections)
return;
if (e->buttons() == Qt::NoButton) {
#if !defined(Q_WS_MAC)
@@ -2430,7 +2430,9 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e)
return;
}
case QHeaderViewPrivate::SelectSections: {
- int logical = logicalIndexAt(pos);
+ int logical = logicalIndexAt(qMax(-d->offset, pos));
+ if (logical == -1 && pos > 0)
+ logical = d->lastVisibleVisualIndex();
if (logical == d->pressed)
return; // nothing to do
else if (d->pressed != -1)