[Qt-interest] dragging from Apple AddressBook to Qt app on Mac

Andy Brice andy at oryxdigital.com
Fri Nov 27 07:32:35 CET 2009


I am trying to trap drag and drop events from the standard Apple address 
book app to my Qt app. This code works fine with Qt 4.4. on Mac OS X 10.4:

|void 
MyView::contentsDropEvent( QDropEvent* e )
{
    QList<QUrl> urls = e->mimeData()->urls();
    ...
|

I can then use the URL to get the vCard.

But from Mac OS X 10.5 the apple address book no longer seems to support 
text/uri-list. So e->mimeData()->urls() returns an empty list. Worse 
still, e->mimeData()->formats() returns an empty list. How do I find out 
which vCards they dragged?

Here is a comment from a Nokia Qt engineer when I logged it as a bug:

    "Adressbook stopped providing drop data as text/uri-list compatible
    flavor data in OS 10.5. Not much we can do about that. The flavor
    they provide instead is 'public.vcard'. We could put up support for
    this as an implementation request, but my gut feeling is that this
    is too application specific, and can just as well be implemented by
    the app developer by subclassing QMacMimeData"

But there is no QMacMimeData in the Qt 4.4 or 4.5 documentation.I found 
a QMacPasteboardMime class: 
http://qt.nokia.com/doc/4.4/qmacpasteboardmime.html . But I have no idea 
if I can use that to access the public.vcard data. I can't find any 
example code.

Any ideas at how I can find out what they dragged?

best regards

Andy Brice
http://www.perfecttableplan.com
http://www.successfulsoftware.net

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091127/a4405293/attachment.html 


More information about the Qt-interest-old mailing list