I use something like:
CreateChooseDir()
{
QString OpenedCreatedDirectory = QFileDialog::getExistingDirectory(this, tr("Choose Directory"),
"/home",
QFileDialog::DontResolveSymlinks | QFileDialog::DontUseNativeDialog);
ui.PathLineEdit -> setText(OpenedDirectory);
ui.PushButtonNext -> setEnable();
}
Problem here is, that I just want to set the PushButtonNext enabled if the QFileDialog was used to create or open a directory. At the moment the PushButtonNext is also enabled when just closing the FileDialog. So I thought of using an emitted signal if possible. Any suggestions?
QFileDialoginherits theacceptedsignal fromQDialog– however, since you’re using the static functionQFileDialog::getExistingDirectory, you won’t have a chance to connect a signal.Instead, simply check the returned
QString: if the user clicks “Cancel”, the string will be null (empty).