Problem dropping a file on ManWindow (Qt 5.4 mac)

  • i'm Using OS X 10.10.
    I have Problem dropping a file (from Finder) on ManWindow
    This problem exists in Qt 5.4 mac

    this is my code
    @void PhotoWindow::dragEnterEvent(QDragEnterEvent *event)
    if (event->mimeData()->hasUrls())

    void PhotoWindow::dropEvent(QDropEvent *event)
    foreach (const QUrl &url, event->mimeData()->urls())
    PhotoAddress << url.toLocalFile();



    But return me something like this : /.file/id=6571367.1965329

    this problem even exists in Qt Creator
    When dropping a file (from Finder) on Qt Creator.

    This should be a bug in Qt 5.4 mac!

  • I ran into this too. It is a problem with Yosemite; I didn't have a problem with Mountain Lion.

    You need to modify the file 'qtbase/src/platformsupport/clipboard/' and recompile Qt (assuming you have the source for Qt).

    The complete function is here including the changes (two lines). It starts on line number 608

    QVariant QMacPasteboardMimeFileUri::convertToMime(const QString &mime, QList<QByteArray> data, QString flav)
    if (!canConvert(mime, flav))
    return QVariant();
    QList<QVariant> ret;
    for (int i = 0; i < data.size(); ++i) {
    QUrl url = QUrl::fromEncoded(;
    if ( == QLatin1String("localhost"))

         if ( && url.path().startsWith(QLatin1String("/.file/id=")))

    url = QUrl::fromNSURL([url.toNSURL() filePathURL]);

    return QVariant(ret);


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.