PDA

View Full Version : Qt Designer Multiple folder and file selection



KSC
31st March 2020, 06:51
Hello all,

I am currently working on GUI where I need to select multiple files from multiple folders using getOpenFileNames() of QFileDialog. But I couldn't find a proper source to load files from multiple folders. Is this possible? If so, can I get some assistance in solving this? Thank you.

d_stranz
31st March 2020, 19:42
I don't think this is possible with QFileDialog, especially using the static getOpen...() methods. You could try using the non-static version, with fileMode() set to ExistingFiles and see if the dialog will let you select multiple files (probably with CTRL-click) while navigating the directory tree.

If that doesn't work, then the only solution I can imagine is to roll your own interface using QFileSystemModel along with a QTreeView set for extended selection, and QItemSelectionModel to hold the selections. You might be able to find an example online where this has already been done.