With the method/command:
OpenCreateDirectory()
{
QString Directory = QFileDialog::getExistingDirectory(this,
tr("Choose Or Create Directory"),
"/home",
QFileDialog::DontResolveSymlinks);
}
I can create a new directory or choose an existing one. Is there a way to disable the possibility to create a new directory? Also, is there a way to disable the possibility to choose an existing directory?
To be more precise: When I use the method above, a window pops up in which I can create a new directory OR open an existing directory. What I want to do is to limit the method, so that I just can create a new directory without being able to just open an existing directory OR in the other case limit the method, so that I just can open an existing directory without being able to create a new directory.
You can prevent the creation of a new directory by using these options:
QFileDialog::DontUseNativeDialog | QFileDialog::ReadOnly
| QFileDialog::ShowDirsOnly
The options ReadOnly
doesn't have any effect if you use native dialogs, at least on Windows.