summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@theqtcompany.com>2014-10-23 08:30:39 (GMT)
committerSimo Fält <simo.falt@theqtcompany.com>2014-12-03 09:16:36 (GMT)
commit020664da2db7086b81864a7f9658cf783b2ec83b (patch)
tree93809d334966116956fcb6b12be12dc8724844d9 /src/gui
parent5b99ee276c5f58fff23f257c1e2daf1bcae8f5b3 (diff)
downloadQt-020664da2db7086b81864a7f9658cf783b2ec83b.zip
Qt-020664da2db7086b81864a7f9658cf783b2ec83b.tar.gz
Qt-020664da2db7086b81864a7f9658cf783b2ec83b.tar.bz2
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> (cherry picked from qtbase/f9408317e70bc2e635a2f9baeff35d1c06227734)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/itemviews/qheaderview.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp
index 36b77a7..6555521 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -2210,7 +2210,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)
@@ -2263,7 +2263,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)