Fix QTreeView header re-ordering bug on Mac OS.
This is a cherry-pick of 0ba850c7a2dbccb8dd6aa1664679bda6cce95065 When the mouse button is released at the end of a drag, Cocoa may simulate an extra mouse moved event. However, the state of the buttons when this event is generated is already 'no button'. This leads to some failsafe code canceling out of the drag state and when the actual mouse release event is finally processed, the header drag state has already been exited and the header drag fails. This patch disables the failsafe code on Cocoa and makes header dragging work when the mouse goes outside the bounds of the header view. Task-number: QTBUG-14179 Change-Id: Ia9fd1ac79f9e7b4b90d3e160298c53d65fb171d3 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
parent
32bc019ac1
commit
4591f67e91
@ -2283,8 +2283,15 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e)
|
||||
if (pos < 0)
|
||||
return;
|
||||
if (e->buttons() == Qt::NoButton) {
|
||||
#if !defined(Q_WS_MAC)
|
||||
// Under Cocoa, when the mouse button is released, may include an extra
|
||||
// simulated mouse moved event. The state of the buttons when this event
|
||||
// is generated is already "no button" and the code below gets executed
|
||||
// just before the mouseReleaseEvent and resets the state. This prevents
|
||||
// column dragging from working. So this code is disabled under Cocoa.
|
||||
d->state = QHeaderViewPrivate::NoState;
|
||||
d->pressed = -1;
|
||||
#endif
|
||||
}
|
||||
switch (d->state) {
|
||||
case QHeaderViewPrivate::ResizeSection: {
|
||||
|
Loading…
Reference in New Issue
Block a user