QFileDialog::getOpenFileContent on Android
-
I'm trying to use QFileDialog::getOpenFileContent() on Android.
The file picker intent opens correctly, but the callback is never invoked, so I cannot obtain the selected file content.
I have already requested MANAGE_EXTERNAL_STORAGE. Using either QFile with a file URL or my own file picker implementation works correctly, so file access itself does not seem to be the issue.
Is QFileDialog::getOpenFileContent() expected to work on Android? If so, are there any additional requirements or configurations that I might have missed? I couldn't find any related bug reports in the Qt bug tracker.
-
Hi,
You should add which version of Qt and Androïd you are using.
-
I don't know about this, but I'd give the app manually permission for all files, and see what happens. I remember there being various issues with QUrl, but don't remember details.
And, of course, something not working in Android, and even the supposedly evolved and mature Qt 6x in Android, is no surprise...
-
I’ve encountered the same issue; it is unrelated to file permissions. For the time being, I’ve implemented a workaround for Android using the QML FileDialog. Qt6.11.1
-
I’ve encountered the same issue; it is unrelated to file permissions. For the time being, I’ve implemented a workaround for Android using the QML FileDialog. Qt6.11.1
@zy2021-02-10
Could you give me some insight how you accomplished this? I've been struggling with using QML FileDialog on QT6.11.1 for the last couple weeks. I even consulted the mighty oracle (OpenAI) and she suggested I abandon FileDialog and look to a java bridge to the native android file picker. -
@SudoSuMe
https://doc-snapshots.qt.io/qt6-6.10/qml-qtquick-dialogs-filedialog.html
Looks like a pretty simple example. Perhaps it meets your needs.