summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris Meyer <cmeyer1969@gmail.com>2012-06-07 16:42:43 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-12 11:16:49 +0200
commit4591f67e917c4a0ecfbb99c7e37d3ebbf4280c9c (patch)
tree1d4d5fea6739bed1c69bb39e0e96373489f4d087 /src
parent32bc019ac1292a0dafabd1d2d2430b44501cbda1 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/itemviews/qheaderview.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 2269bde513..01cfc4034e 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -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: {