QFileDialog::setDirectory() and directory() should be symmetric

QFileDialog::setDirectory() calls options->setInitialDirectory().
Then QFileDialogPrivate::helperPrepareShow() calls it again with the
result of QFileDialog::directory().  Assuming there are cases where
that's actually necessary, we need QFileDialog::directory() to return
the same one which was previously set in setDirectory().

Task-number: QTBUG-35779
Change-Id: Iac1f88c770ff1ef06a7f884f9a42d72674c967ba
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Shawn Rutledge 2013-12-27 16:58:31 +01:00 committed by The Qt Project
parent ffac6ee267
commit e37616bbad

View File

@ -1004,7 +1004,11 @@ void QFileDialog::setDirectory(const QString &directory)
QDir QFileDialog::directory() const
{
Q_D(const QFileDialog);
return QDir(d->nativeDialogInUse ? d->directory_sys().toLocalFile() : d->rootPath());
if (d->nativeDialogInUse) {
QString dir = d->directory_sys().toLocalFile();
return QDir(dir.isEmpty() ? d->options->initialDirectory().toLocalFile() : dir);
}
return d->rootPath();
}
/*!