diff options
author | Stefan Wastl <stefan.wastl@native-instruments.de> | 2022-04-25 14:21:27 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2022-04-26 00:24:40 +0200 |
commit | 1fbd8c282e2eb293cdcb1f0ff097ff9548be975d (patch) | |
tree | 3a73395e4de2f961f9978f0363493f3032987f6c /src/plugins/platforms/cocoa | |
parent | 0248838ee04760bebf3aa89a38bd51ce1b16a5d7 (diff) |
macOS: Use originating view as drag source when dragging multiple items
We're already tracking the last view along with the last event, so
use that instead of always assuming the drag started from the window's
content view.
Fixes: QTBUG-102584
Pick-to: 6.2 6.3
Change-Id: Ibe8506b0f91ecdfe6e7fe91e17c129b4d7552880
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: <stefan.wastl@native-instruments.de>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoadrag.mm | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm index f681981d34..fa073e5e29 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.mm +++ b/src/plugins/platforms/cocoa/qcocoadrag.mm @@ -175,13 +175,11 @@ bool QCocoaDrag::maybeDragMultipleItems() const QMacAutoReleasePool pool; - NSWindow *theWindow = [m_lastEvent window]; - Q_ASSERT(theWindow); - - if (![theWindow.contentView respondsToSelector:@selector(draggingSession:sourceOperationMaskForDraggingContext:)]) + NSView *view = m_lastView ? m_lastView : m_lastEvent.window.contentView; + if (![view respondsToSelector:@selector(draggingSession:sourceOperationMaskForDraggingContext:)]) return false; - auto *sourceView = static_cast<NSView<NSDraggingSource>*>(theWindow.contentView); + auto *sourceView = static_cast<NSView<NSDraggingSource>*>(view); const auto &qtUrls = m_drag->mimeData()->urls(); NSPasteboard *dragBoard = [NSPasteboard pasteboardWithName:NSPasteboardNameDrag]; |