QCocoaDrag: don't add pasteboard items with non-absolute URLs
AppKit rejects them and we end up with inconsistent number of pasteboard items and drag images: "NSURLs written to the pasteboard via NSPasteboardWriting must be absolute URLs." "There are 1 items on the pasteboard, but 2 drag images." Fixes: QTBUG-105711 Change-Id: I7b1bc99f6e0b2b304f92f69125fb6af4ab5e303f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit da951c9dbf091b15e76fa63055a299e29a9001ad) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
a5e722d71f
commit
398d5d6038
@ -184,6 +184,12 @@ bool QCocoaDrag::maybeDragMultipleItems()
|
|||||||
// contains a combined picture for all urls we drag.
|
// contains a combined picture for all urls we drag.
|
||||||
auto imageOrNil = dragImage;
|
auto imageOrNil = dragImage;
|
||||||
for (const auto &qtUrl : qtUrls) {
|
for (const auto &qtUrl : qtUrls) {
|
||||||
|
if (!qtUrl.isValid())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (qtUrl.isRelative()) // NSPasteboardWriting rejects such items.
|
||||||
|
continue;
|
||||||
|
|
||||||
NSURL *nsUrl = qtUrl.toNSURL();
|
NSURL *nsUrl = qtUrl.toNSURL();
|
||||||
auto *newItem = [[[NSDraggingItem alloc] initWithPasteboardWriter:nsUrl] autorelease];
|
auto *newItem = [[[NSDraggingItem alloc] initWithPasteboardWriter:nsUrl] autorelease];
|
||||||
const NSRect itemFrame = NSMakeRect(itemLocation.x, itemLocation.y,
|
const NSRect itemFrame = NSMakeRect(itemLocation.x, itemLocation.y,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user