Details
-
Bug
-
Resolution: Incomplete
-
P2: Important
-
None
-
5.15.14, 6.5.2
Description
User wants to set dialog to open up on predefined location:
"
with the introduction of Scoped Storage in Android 11, direct access to directories is no longer possible. As a result, I intended to use the QFileDialog as described in the Qt Documentation.
See in QStandardPaths:
On Android 11 and above, public directories are no longer directly accessible in scoped storage mode. Thus, paths of the form "<USER>/DirName" are not returned. Instead, you can use QFileDialog which uses the Storage Access Framework (SAF) to access such directories.
I would use the QFileDialog to file opening and saving. My aim is for the dialog to initially appear within a predefined location such as 'Documents', 'Downloads', or a distinct folder at the same hierarchy level. Unfortunately, I'm facing a problem where the dialog always opens in the last selected folder, which is not what I want.
"
From the R&D we were informed that use of QFileDialog setDirectory should help with users request:
"
the file dialog doesn't take the old file scheme paths for public storage into account, so passing them to the file dialog won't work. However, if you have a content url already of a tree, I assume you can use https://doc.qt.io/qt-6/qml-qtquick-dialogs-filedialog.html#currentFolder-prop or https://doc.qt.io/qt-6/qfiledialog.html#setDirectory to set that path and Qt would pass that to the native file dialog as EXTRA_INITIAL_URI. Though, if that doesn't work probably it's a bug.
"
User tested this with the attached example and and the default directory does not change.
Attachments
Issue Links
- is blocked by
-
QTCREATORBUG-29928 Android debugging fails => lands in disassembler
-
- Closed
-