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

set root directory for qFileDialog()



  • hi buddies.

    i am using qDialog to get user selected file path.

    qFileDialog  *fileDlg;
    fileName =fileDlg->getOpenFileName(this, tr("Please choose video file"), tr("/run/media/sda1/videos/"),tr("All files (*.mp4)"), 0, QFileDialog::DontUseNativeDialog);
    

    but i need to restrict qfileDialog window to the directory which i set as root. it means that user should not be able to use "Back" button and access to parents directoies.


  • Lifetime Qt Champion

    Hi,

    I don't remember exactly but maybe using a proxy model might do the job can get you the result you want.


Log in to reply