简体   繁体   English

为 WebAssembly 加载 Qt 中的多个文件

[英]Loading multiple files in Qt for WebAssembly

I need to use a file dialog in order to upload several files from client to server.我需要使用文件对话框将多个文件从客户端上传到服务器。 I am aware about QFileDialog::getOpenFileContent() , but what about multiple files uploading (multiselect using file dialog in some directory) in Qt for WebAssembly?我知道QFileDialog::getOpenFileContent() ,但是对于 WebAssembly 的 ZE8801102A40AD89DDCFDCAEBF008D25Z 中的多个文件上传(使用某个目录中的文件对话框进行多选)呢? I don't mind against workaround.我不介意解决方法。

I have tried我努力了

void QFileDialog::getOpenFileContent(const QString &nameFilter, const std::function<void (const QString &, const QByteArray &)> &fileOpenCompleted)

the signature says that I've got only one pair <name, content>.签名说我只有一对 <name, content>。 But I'd like to have multiple files selected and loaded using single dialog execution.但我想使用单个对话框执行来选择和加载多个文件。

If you need multiple file support, use the HTML input tag, then you need to feed the files to the Qt app by using emscripten bindings, you can export a function to javascript, that way you can call it once the user has selected the files If you need multiple file support, use the HTML input tag, then you need to feed the files to the Qt app by using emscripten bindings, you can export a function to javascript, that way you can call it once the user has selected the files

<input type="file" id="files" multiple>

The details are quite complicated, but this is just an idea.细节相当复杂,但这只是一个想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM