0

I have a QFileDialog prompting the user to select a directory. I am running QT version 4.3.5. I do not have the option of upgrading either.

I want the user to only be able to choose directories that contain two files with specific names. Something along the lines of disabling the "Choose" button if it does not contain these two specific files.

The searching I have done has only led me to ways of filtering the results, which is not what I want to do since the user needs to be able to browse all directories and all sub directories. If a directory is selected, then the check should be made to disable/enable the "Choose" button based on the above criteria.

Like I said, the only half close solutions I have found are explained in this thread QFileDialog for directories that have certain content or this thread qfiledialog - Filtering Folders?

Both of those half solutions to my question require the use of QFileSystemModel, which wasn't introduced until QT 4.4.

How can I enable/disable the "Choose" button of a QFileDialog with QFileDialog::Directory set as the FileMode based on whether or not the selected/activated directory contains two specific files?

Thanks

Community
  • 1
  • 1
halexh
  • 3,021
  • 3
  • 19
  • 19

1 Answers1

0

You need to copy the file dialog's sources over to your project, modify the name of the class, and start tweaking it. That's the only way, unfortunately.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313