Although QFileDialog::getOpenFileContent works as expected when deployed on desktop, it ignores the filter option when deployed on Web Assembly, displaying all available files and not only the ones set in the filter.
Executing this snippet on desktop...
auto fileContentReady = [this](const QString &fileName, const QByteArray &fileContent) {
if (!fileName.isEmpty()) {
emit fileOpened(fileName, fileContent);
}
};
QString myFilter (tr("Images (*.png *.xpm *.jpg)"));
QFileDialog::getOpenFileContent(myFilter, fileContentReady);
... will open a file selector where only the extensions provided by myFilter are displayed. But this same code wont work on Web Assembly deployment and All files are displayed instead.
Tested on Qt 6.5.2 but also not working on previous 6.5.x SDK. The same occurs on different web browsers.
Is it a Qt/emscripten bug or am I missing something?
Well, it looks like it's a Qt issue: https://bugreports.qt.io/browse/QTBUG-115087?filter=-4&jql=text%20~%20%22getOpenFileContent%22%20order%20by%20created%20DESC