Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QFileSystemModel with QT for android - permission denied problem



  • Hello,

    I am using Qt 5.12.3 to make a native file browser for android, using QFileSystemModel. Here is the code that i used :

    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 as in the image below, with the output message :
    E libFileDialog.so: inotify_add_watch(/) failed: (Permission denied)
    0_1563832866396_Screenshot_20190722-235826.jpg

    An other file browser application work fine (picture below) after enabling acces.

    0_1563833026720_Screenshot_20190722-235846.jpg

    Is there a way to allow acces permission for the QFileSystemModel to show the storage memory contents ?


Log in to reply