diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2013-12-27 16:58:31 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-06 12:55:30 +0100 |
commit | e37616bbad5cadf07f6002f02da880c2630154cb (patch) | |
tree | 986cc7666d8b11533712fe81a7284c251b75bf9c /src | |
parent | ffac6ee2673a573a9db4f75a89c4c53251fa1304 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/dialogs/qfiledialog.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index da026d23a6..cd95b824a6 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -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(); } /*! |