I would like to build a dialog similar to QFileDialog::getExistingDirectory() for which the OK-button only is enabled when the selected directory contains certain files.
I know I cannot achieve this with QFileDialog, instead I would have to come up with my own QDialog that has a QTreeView coupled to a QFileSystemModel.
Here is an example:
void slotDirectorySelected( const QModelIndex & index )
{
QFileInfo info = fileSystemModel->fileInfo( index );
QDir selectedDir = info.dir();
foreach( const QString entry, selectedDir.entryList() ) {
// do something with the entry
}
}