diff --git a/src/gui/fspathedit.cpp b/src/gui/fspathedit.cpp index 9d36cb84c..ed9aceec8 100644 --- a/src/gui/fspathedit.cpp +++ b/src/gui/fspathedit.cpp @@ -111,8 +111,12 @@ FileSystemPathEdit::FileSystemPathEditPrivate::FileSystemPathEditPrivate( void FileSystemPathEdit::FileSystemPathEditPrivate::browseActionTriggered() { Q_Q(FileSystemPathEdit); + + const QFileInfo fileInfo {q->selectedPath()}; + const QString directory = (m_mode == FileSystemPathEdit::Mode::DirectoryOpen) || (m_mode == FileSystemPathEdit::Mode::DirectorySave) + ? fileInfo.absoluteFilePath() + : fileInfo.absolutePath(); QString filter = q->fileNameFilter(); - QString directory = q->currentDirectory().isEmpty() ? QDir::homePath() : q->currentDirectory(); QString selectedPath; switch (m_mode) @@ -308,11 +312,6 @@ void FileSystemPathEdit::setDialogCaption(const QString &caption) d->m_dialogCaption = caption; } -QString FileSystemPathEdit::currentDirectory() const -{ - return QFileInfo(selectedPath()).absoluteDir().absolutePath(); -} - QWidget *FileSystemPathEdit::editWidgetImpl() const { Q_D(const FileSystemPathEdit); diff --git a/src/gui/fspathedit.h b/src/gui/fspathedit.h index f6ba65cb7..cab9e71b6 100644 --- a/src/gui/fspathedit.h +++ b/src/gui/fspathedit.h @@ -64,7 +64,6 @@ public: Mode mode() const; void setMode(Mode mode); - QString currentDirectory() const; QString selectedPath() const; void setSelectedPath(const QString &val);