From 4135951ae8162c4f8ca557eefb8cd2db39f759b0 Mon Sep 17 00:00:00 2001 From: Teemu Katajisto Date: Tue, 16 Oct 2012 12:06:14 +0300 Subject: [PATCH] Cocoa: use defaultPixmap() if pixmap is not set for drag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-26971 Change-Id: I6aed56a6b292c5aeebf38278d2a1fa982346c909 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoadrag.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm index d98c49a1ce..67881d8680 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.mm +++ b/src/plugins/platforms/cocoa/qcocoadrag.mm @@ -119,7 +119,11 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o) m_drag = o; m_executed_drop_action = Qt::IgnoreAction; - NSImage *nsimage = static_cast(qt_mac_create_nsimage(m_drag->pixmap())); + QPixmap pm = m_drag->pixmap(); + if (pm.isNull()) + pm = defaultPixmap(); + + NSImage *nsimage = static_cast(qt_mac_create_nsimage(pm)); QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacPasteboardMime::MIME_DND); m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy"));