QCocoaDrag - set image only on the first drag item
This image is already a combined image of all urls that we drag. Pick-to: 5.15 Change-Id: I8fe45f64a6022881320d100f8a6f4a25fcac73b9 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>bb10
parent
bfd07072fe
commit
7ee9bfc158
|
|
@ -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];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue