App's path for external storage in Qt ?
-
-
Hi,
I am trying to make a file browser for android using Qt 5.12.3 and QFileSystemModel class. I read that getExternalStorageDirectory() give the path of the external storage of directory in JAVA. Is there an equivalent for this function in C++ Qt ?
@ZINE Take a look at https://doc.qt.io/qt-5/qtandroidextras-index.html
-
Hi
Im not sure what the JAVA versions gives you but Qt has
https://doc.qt.io/qt-5/qstandardpaths.html
Which might be able to give you the folder you are looking for. -
Hi
Im not sure what the JAVA versions gives you but Qt has
https://doc.qt.io/qt-5/qstandardpaths.html
Which might be able to give you the folder you are looking for.@mrjj I already used the following code :
dir_model=new QFileSystemModel(this);
dir_liste=new QTreeView(this);
dir_model->setRootPath(QDir::rootPath());
dir_liste->setModel(dir_model);I add permission "android.permission.READ_EXTERNAL_STORAGE" and "android.permission.WRITE_EXTERNAL_STORAGE" to the AndroidManifest.xml file. Also i add manual permission : Settings-> apps -> permissions -> storage, for my android app.
When i run my app i get an empty :/ directory, with the output message :
E libFileDialog.so: inotify_add_watch(/) failed: (Permission denied)How i can use QStandardpaths in my previous code ?