qt5base-lts/tests/auto/widgets
Giuseppe D'Angelo b5b2640a65 QHeaderView: fix spurious sorting
QHeaderView sorting may be triggered when the user performs
some mouse interactions that should really not result in sorting.

Generally speaking, this happens when the user:

* presses on a non-movable section (A)
* moves on another section (B)
* releases on that section

resulting in B becoming sorted / flipping sorting.

(Non-movable is required, otherwise dragging would cause section moving,
not sorting.)

To make the matter worse, QHeaderView doesn't check that the release
happens within its geometry. This makes sense when moving sections: one
is able to drag a section horizontally/vertically even if the mouse
leaves the QHeaderView.

But when not moving sections, this means that one can

* press on section (A),
* move the mouse anywhere vertically (for a horizontal bar, mut.mut
  for a vertical) above or below another section (B), that is,
  outside QHeaderView's geometry
* release the mouse

and cause B to be sorted.

Fix it by

1) remembering which one was the section that the user originally
clicked on; that's the only one that can possibly become sorted
(if we're not moving and other conditions hold). No other variable
seemed to remember this.

2) on release, check that it happens within that section's geometry.
If so, sort.

Pick-to: 6.0 5.15
Change-Id: Icfb67662221efbde019711f933781ee1e7d9ac43
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-12-01 15:57:10 +01:00
..
dialogs Fix tst_qfiledialog2 in case directory ~/foo exists 2020-11-24 21:50:55 +01:00
effects Get rid of all usage of QApplication:desktop 2020-10-14 06:38:43 +02:00
graphicsview Android: exclude tests crashing at start 2020-11-16 13:35:44 +02:00
itemviews QHeaderView: fix spurious sorting 2020-12-01 15:57:10 +01:00
kernel Add widget-based test for TouchCancel event 2020-11-30 23:11:04 +01:00
styles Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
util Skip QSystemTrayIcon unit test for offscreen platform 2020-11-24 18:54:45 +01:00
widgets Disable some OpenGL and QRhi tests for offscreen backend 2020-12-01 14:14:45 +01:00
CMakeLists.txt Begin port of qtbase to CMake 2018-11-01 11:48:46 +00:00
widgets.pro Move QGestureRecognizer test to widgets/kernel 2017-06-02 18:36:11 +00:00