summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2020-09-21 14:19:11 +0200
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2020-09-23 18:55:53 +0200
commit720e2e0c92ca6635c5f05f318770a70cf653c1c7 (patch)
treeb5e065341cb3ffd0e0504949c0e78fd39443f2ba /src/plugins/platforms
parent8a50a114375d1ed5a564ce48836a3e6515aeceb1 (diff)
QCocoaDrag::drag - make sure clipboard is ours and populated
This fix is not final yet, it's just to plumb the serious bug/regression of accessing NSPasteBoard in some strange state and the one we have not populated yet/do not even own (?). Drag image(s) is broken atm and will be fixed in the follow-up patch. Pick-to: 5.15 Task-number: QTBUG-71939 Change-Id: I5c3ac3ec138d7407c2e0c206485478aa5244ae15 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.mm8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm
index d56f30b063..40ce461c30 100644
--- a/src/plugins/platforms/cocoa/qcocoadrag.mm
+++ b/src/plugins/platforms/cocoa/qcocoadrag.mm
@@ -130,6 +130,10 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
m_drag = o;
m_executed_drop_action = Qt::IgnoreAction;
+ QMacPasteboard dragBoard(CFStringRef(NSPasteboardNameDrag), QMacInternalPasteboardMime::MIME_DND);
+ m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy"));
+ dragBoard.setMimeData(m_drag->mimeData(), QMacPasteboard::LazyRequest);
+
if (maybeDragMultipleItems())
return m_executed_drop_action;
@@ -138,10 +142,6 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
NSImage *dragImage = [NSImage imageFromQImage:pm.toImage()];
Q_ASSERT(dragImage);
- QMacPasteboard dragBoard(CFStringRef(NSPasteboardNameDrag), QMacInternalPasteboardMime::MIME_DND);
- m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy"));
- dragBoard.setMimeData(m_drag->mimeData(), QMacPasteboard::LazyRequest);
-
NSPoint event_location = [m_lastEvent locationInWindow];
NSWindow *theWindow = [m_lastEvent window];
Q_ASSERT(theWindow);