diff options
author | Chris Meyer <cmeyer1969@gmail.com> | 2012-02-21 20:14:48 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-28 14:35:06 (GMT) |
commit | 0ba850c7a2dbccb8dd6aa1664679bda6cce95065 (patch) | |
tree | 33de1365d21fb84387441e96f2da7610c9faa777 /src/gui | |
parent | 91cf813c816582188ef8943b29338c3db06d1133 (diff) | |
download | Qt-0ba850c7a2dbccb8dd6aa1664679bda6cce95065.zip Qt-0ba850c7a2dbccb8dd6aa1664679bda6cce95065.tar.gz Qt-0ba850c7a2dbccb8dd6aa1664679bda6cce95065.tar.bz2 |
Fix QTreeView header re-ordering bug on Mac OS.
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: Ic2762b77b78ef7b99f97ff9ed1f58254de1eba82
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: Andrew Semenenko
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/itemviews/qheaderview.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index 2a41b7e..ce885d2 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -2204,8 +2204,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: { |