diff options
author | Andy Shaw <andy.shaw@qt.io> | 2021-01-13 17:40:18 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-04-29 10:16:13 +0000 |
commit | 5a8f1cfab7e692367c4dddbcc6775864c5a4c246 (patch) | |
tree | 9b07b5e51fbae8ff448f9edcdee113c0dd59d60c /src/plugins/platforms/cocoa/qnsview_dragging.mm | |
parent | 4343fd921cac5b71c0a968a93550ff8e87f39159 (diff) | |
download | qtbase-5a8f1cfab7e692367c4dddbcc6775864c5a4c246.tar.gz |
macOS: Don't override action set during drop handling
When the drop has been handled, the target might have accepted a specific
action by calling QDropEvent::setDropAction. Don't override that with
the operation received by the OS if the drag'n'drop operation takes place
within the same application. If the operation comes from outside, we have
no choice but to trust the OS.
This way the drag-site will get the action accepted by the drop-site when
QDrag::drag returns.
Fixes: QTBUG-77427
Change-Id: I0e4c86adeeea66b345966a03a3251fa62263b3e8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit a014300898bd3bd574ef19bba7123d4b5a07789b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/plugins/platforms/cocoa/qnsview_dragging.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview_dragging.mm | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview_dragging.mm b/src/plugins/platforms/cocoa/qnsview_dragging.mm index 1d3820997c..0dab09e421 100644 --- a/src/plugins/platforms/cocoa/qnsview_dragging.mm +++ b/src/plugins/platforms/cocoa/qnsview_dragging.mm @@ -297,7 +297,9 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); Q_ASSERT(nativeDrag); nativeDrag->exitDragLoop(); - nativeDrag->setAcceptedAction(qt_mac_mapNSDragOperation(operation)); + // for internal drag'n'drop, don't override the action the drop event accepted + if (!nativeDrag->currentDrag()) + nativeDrag->setAcceptedAction(qt_mac_mapNSDragOperation(operation)); // Qt starts drag-and-drop on a mouse button press event. Cococa in // this case won't send the matching release event, so we have to |