Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QFileDialog: Select file only from a pre-defined directory
Ankit.Jain last edited by
I am looking to select a file (of specified type) from a predefined folder. The idea is to not allow the user to browse; just see the files available in the folder and allow him/her to choose from them. I created a basic implementation for the same using QFileDialog, but have been unable to prevent the user from browsing the file system to search for the file.
Any help would be much appreciated.
Chris Hennes last edited by Chris Hennes
I would be inclined to not use
QFileDialogfor that task -- it's designed to look and function the way users expect a file selection dialog to work, which includes navigation. I have a similar use-case in a program I'm currently working on, and my solution was to create a very simple custom dialog that simply presents a list of the files they are allowed to select from. It's very easy to get that list from a
QDirand drop that