diff options
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoadrag.mm | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm index 40ce461c30..f681981d34 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.mm +++ b/src/plugins/platforms/cocoa/qcocoadrag.mm @@ -216,13 +216,18 @@ bool QCocoaDrag::maybeDragMultipleItems() // 0. We start from URLs, which can be actually in a list (thus technically // only ONE item in the pasteboard. The fact it's only one does not help, we are // still getting an exception because of the number of items/images mismatch ... + // We only set the image for the first item and nil for the rest, the image already + // contains a combined picture for all urls we drag. + auto imageOrNil = dragImage; for (const auto &qtUrl : qtUrls) { NSURL *nsUrl = qtUrl.toNSURL(); auto *newItem = [[[NSDraggingItem alloc] initWithPasteboardWriter:nsUrl] autorelease]; const NSRect itemFrame = NSMakeRect(itemLocation.x, itemLocation.y, dragImage.size.width, dragImage.size.height); - [newItem setDraggingFrame:itemFrame contents:dragImage]; + + [newItem setDraggingFrame:itemFrame contents:imageOrNil]; + imageOrNil = nil; [dragItems addObject:newItem]; } // 1. Repeat for non-url items, if any: @@ -231,7 +236,7 @@ bool QCocoaDrag::maybeDragMultipleItems() const NSRect itemFrame = NSMakeRect(itemLocation.x, itemLocation.y, dragImage.size.width, dragImage.size.height); - [newItem setDraggingFrame:itemFrame contents:dragImage]; + [newItem setDraggingFrame:itemFrame contents:imageOrNil]; [dragItems addObject:newItem]; } |