From 88410105978d5fb4344207cd5d296057ced0f27d Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Thu, 22 Jul 2010 14:52:29 +0200 Subject: Drag & Drop failing in itemviews on Cocoa. While generating the QDragMoveEvent, we were always reusing the last drop action set by the user. This is not correct, we should copy the action only if a valid action set before. This is the behavior on Windows. Task-number: QTBUG-9486 Reviewed-by: Denis --- src/gui/kernel/qcocoaview_mac.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 1935531..a552ce7 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -390,7 +390,10 @@ static int qCocoaViewCount = 0; if (QDragManager::self()->source()) mimeData = QDragManager::self()->dragPrivate()->data; QDragMoveEvent qDMEvent(posDrag, qtAllowed, mimeData, QApplication::mouseButtons(), modifiers); - qDMEvent.setDropAction(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).lastAction); + if (QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).lastAction != Qt::IgnoreAction + && QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).buttons == qDMEvent.mouseButtons() + && QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).modifiers == qDMEvent.keyboardModifiers()) + qDMEvent.setDropAction(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).lastAction); qDMEvent.accept(); QApplication::sendEvent(qwidget, &qDMEvent); -- cgit v0.12