Question about passing invalid directory path to QFileDialog::getExistingDirectory()
-
Hi All,
What happens when passing theQFileDialog::getExistingDirectory()a illegal path?More specific passing the third argument a path to directory that doesn't exist:
QString QFileDialog::getExistingDirectory(QWidget * parent = 0, const QString & caption = QString(), const QString & dir = QString(), Options options = ShowDirsOnly);What will be the return value in this case?
-
@walle19 said in Question about passing invalid directory path to QFileDialog::getExistingDirectory():
How does it choose where to open at if the third argument is an invalid directory path?
"The dialog's working directory is set to dir, and the caption is set to caption. Either of these may be an empty string in which case the current directory and a default caption will be used respectively."
-
Hi All,
What happens when passing theQFileDialog::getExistingDirectory()a illegal path?More specific passing the third argument a path to directory that doesn't exist:
QString QFileDialog::getExistingDirectory(QWidget * parent = 0, const QString & caption = QString(), const QString & dir = QString(), Options options = ShowDirsOnly);What will be the return value in this case?
@walle19 said in Question about passing invalid directory path to QFileDialog::getExistingDirectory():
What will be the return value in this case?
The return value is going to be the directory you will have selected from the file dialog. If you discarded the dialog (i.e. didn't select anything), then it's an empty string.
-
@walle19 said in Question about passing invalid directory path to QFileDialog::getExistingDirectory():
What will be the return value in this case?
The return value is going to be the directory you will have selected from the file dialog. If you discarded the dialog (i.e. didn't select anything), then it's an empty string.
@kshegunov I understand.
So where is the file dialog going to open at ?
If I pass the third argument a valid directory path then it will open on the valid directory.
How does it choose where to open at if the third argument is an invalid directory path? -
@walle19 said in Question about passing invalid directory path to QFileDialog::getExistingDirectory():
How does it choose where to open at if the third argument is an invalid directory path?
"The dialog's working directory is set to dir, and the caption is set to caption. Either of these may be an empty string in which case the current directory and a default caption will be used respectively."
-
@kshegunov I understand.
So where is the file dialog going to open at ?
If I pass the third argument a valid directory path then it will open on the valid directory.
How does it choose where to open at if the third argument is an invalid directory path? -
@walle19 said in Question about passing invalid directory path to QFileDialog::getExistingDirectory():
How does it choose where to open at if the third argument is an invalid directory path?
"The dialog's working directory is set to dir, and the caption is set to caption. Either of these may be an empty string in which case the current directory and a default caption will be used respectively."
@Christian-Ehrlicher I havn't used an empty string. The documentation doesn't say anything about invalid string / path
-
@Christian-Ehrlicher I havn't used an empty string. The documentation doesn't say anything about invalid string / path
@walle19 Then try it out. Don't see why it should behave different for non-existing and empty directory since an empty directory is also non-existent...