解决mac 10.10 拖拽QUrls fileid=xxx

const char * getPlatformFilePath(QUrl url)
{
    if (url.url().startsWith("file:///.file/id=") || url.url().startsWith("/.file/id=")) {
        CFURLRef cfurl = url.toCFURL();
        CFErrorRef error = 0;
        CFURLRef absurl = CFURLCreateFilePathURL(kCFAllocatorDefault, cfurl, &error);
        url = QUrl::fromCFURL(absurl);
        CFRelease(cfurl);
        CFRelease(absurl);
        return url.toLocalFile().toStdString().c_str();
    }else{
        return url.toLocalFile().toStdString().c_str();
    }
}

你可能感兴趣的:(qt)