diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-11-25 22:03:38 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-12-02 15:41:58 +0000 |
commit | dbe6a65bb3acda41f8c21b26550b23da41268abb (patch) | |
tree | 4aa5ce9b6900cc828f234243425dc8334e572d29 /src/network/access/qhttpnetworkconnectionchannel.cpp | |
parent | 44d2b6eb4c8bea32db69d02a0ef706e7aed8cf8b (diff) |
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.
Change-Id: Icfb67662221efbde019711f933781ee1e7d9ac43
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit b5b2640a65de20d05890fa9e6462bb7b88f83964)
Diffstat (limited to 'src/network/access/qhttpnetworkconnectionchannel.cpp')
0 files changed, 0 insertions, 0 deletions