OSX: replace use of deprecated API.

dragImage:at:offset:event:pasteboard:source:slideBack: on NSView is
deprecated since 10.7. Use the one on NSWindow instead.

Change-Id: Ia1c2ea367ae2ca5194b52ea57ab261461bf8b529
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
This commit is contained in:
Erik Verbruggen 2015-10-20 13:38:22 +02:00
parent 8515aa1871
commit 07475c662e

View File

@ -127,16 +127,17 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
dragBoard.setMimeData(m_drag->mimeData(), QMacPasteboard::LazyRequest); dragBoard.setMimeData(m_drag->mimeData(), QMacPasteboard::LazyRequest);
NSPoint event_location = [m_lastEvent locationInWindow]; NSPoint event_location = [m_lastEvent locationInWindow];
NSPoint local_point = [m_lastView convertPoint:event_location fromView:nil]; NSWindow *theWindow = [m_lastEvent window];
local_point.x -= hotSpot.x(); Q_ASSERT(theWindow != nil);
event_location.x -= hotSpot.x();
CGFloat flippedY = pm.height() - hotSpot.y(); CGFloat flippedY = pm.height() - hotSpot.y();
local_point.y += flippedY; event_location.y -= flippedY;
NSSize mouseOffset = NSMakeSize(0.0, 0.0); NSSize mouseOffset_unused = NSMakeSize(0.0, 0.0);
NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard]; NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
[m_lastView dragImage:nsimage [theWindow dragImage:nsimage
at:local_point at:event_location
offset:mouseOffset offset:mouseOffset_unused
event:m_lastEvent event:m_lastEvent
pasteboard:pboard pasteboard:pboard
source:m_lastView source:m_lastView