diff options
author | Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com> | 2012-08-23 20:27:11 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-25 19:04:56 +0200 |
commit | 77e57387ac7d4f6187867059797a1d6587351ddb (patch) | |
tree | 3e0a542759e7a7a4515242cf03dc0f2045d279b9 /src | |
parent | c008420eb5ad02b8f23a144d0e977f09d27b8ed1 (diff) |
OSX: Drag and Drop QMimeData.
When dragging and dropping within the same application, the QDropEvent
should contain exactly the same instance of QMimeData as it was set to
QDrag.
This solves the problem in
https://bugreports.qt-project.org/browse/QTBUG-26953
Change-Id: I3bc4da845ff4293c509343c1c8c62fc331416ec0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 72b948912a..9b293a7889 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1047,12 +1047,19 @@ static QTouchDevice *touchDevice = 0; NSPoint windowPoint = [self convertPoint: [sender draggingLocation] fromView: nil]; QPoint qt_windowPoint(windowPoint.x, windowPoint.y); Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations([sender draggingSourceOperationMask]); - QCocoaDropData mimeData([sender draggingPasteboard]); // update these so selecting move/copy/link works QGuiApplicationPrivate::modifier_buttons = [self convertKeyModifiers: [[NSApp currentEvent] modifierFlags]]; - QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(m_window, &mimeData, qt_windowPoint, qtAllowed); + QPlatformDragQtResponse response(false, Qt::IgnoreAction, QRect()); + if ([sender draggingSource] != nil) { + QCocoaDrag* nativeDrag = static_cast<QCocoaDrag *>(QGuiApplicationPrivate::platformIntegration()->drag()); + response = QWindowSystemInterface::handleDrag(m_window, nativeDrag->platformDropData(), qt_windowPoint, qtAllowed); + } else { + QCocoaDropData mimeData([sender draggingPasteboard]); + response = QWindowSystemInterface::handleDrag(m_window, &mimeData, qt_windowPoint, qtAllowed); + } + return qt_mac_mapDropAction(response.acceptedAction()); } @@ -1071,9 +1078,15 @@ static QTouchDevice *touchDevice = 0; NSPoint windowPoint = [self convertPoint: [sender draggingLocation] fromView: nil]; QPoint qt_windowPoint(windowPoint.x, windowPoint.y); Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations([sender draggingSourceOperationMask]); - QCocoaDropData mimeData([sender draggingPasteboard]); - QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(m_window, &mimeData, qt_windowPoint, qtAllowed); + QPlatformDropQtResponse response(false, Qt::IgnoreAction); + if ([sender draggingSource] != nil) { + QCocoaDrag* nativeDrag = static_cast<QCocoaDrag *>(QGuiApplicationPrivate::platformIntegration()->drag()); + response = QWindowSystemInterface::handleDrop(m_window, nativeDrag->platformDropData(), qt_windowPoint, qtAllowed); + } else { + QCocoaDropData mimeData([sender draggingPasteboard]); + response = QWindowSystemInterface::handleDrop(m_window, &mimeData, qt_windowPoint, qtAllowed); + } return response.isAccepted(); } |