Important: Please read the Qt Code of Conduct -

Select multiple files in QFileDialog

  • Haven't found discussion of this specific issue.

    I use QFileDialog (most or next-most recent version) to select multiple files for action. Is is possible to create the dialog with multiple files pre-selected? It seems that selectFile(name) only sets the selected filename in the edit field, but does not "check the box" in the list of file names. Hence, for multiple calls to selectFile only the last one seems to have any effect.

    Is there another function to call that "checks the box" for multiple files?


  • it doesn't seem like there is an option for pre-selecting a list of files. I think the logic being that there is not a strong use case for such a feature. Also, the directory is scanned every time the dialog is realized, so there is the possibility of the pre-selected list being at least partially invalid. You can always make your own custom file selection dialog and add the feature if it is important.

Log in to reply