如何在android中使用带有链接的QFile打开文件-content://com.android.providers.downloads.documents/document/raw.pdf
我尝试了下面的代码,但它显示文件没有打开
QString path("content://com.android.providers.downloads.documents/document/raw.pdf");
QUrl path_url(path);
path = path_url.toLocalFile();
QFile* file = new QFile(path);
file->open(QIODevice::ReadOnly)
QQmlFile可以将其格式化为/storage/emulated/0/。。。。
Q字符串路径(";content://com.android.providers.downloads.documents/document/raw.pdf"(;QUrl url(路径(;
QFile file(QQmlFile::urlToLocalFileOrQrc(url));
if (!file.open(QFile::ReadOnly)) {
emit error(tr("Could not open file. '%1'").arg(file.errorString()));
return;
}
示例,用于详细实现。