From b29a52dfa82c262a84054daedc481cba23e841b1 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Mon, 9 Aug 2021 12:42:32 +0800 Subject: [PATCH] Use the same icon for selecting folders/files As stated in Qt doc, the `QStyle::SP_DialogOpenButton` is only for a button within QDialogButtonBox which means it isn't suitable elsewhere. --- src/gui/fspathedit.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/gui/fspathedit.cpp b/src/gui/fspathedit.cpp index 146ad965c..be8e15c16 100644 --- a/src/gui/fspathedit.cpp +++ b/src/gui/fspathedit.cpp @@ -155,26 +155,21 @@ QString FileSystemPathEdit::FileSystemPathEditPrivate::dialogCaptionOrDefault() void FileSystemPathEdit::FileSystemPathEditPrivate::modeChanged() { - QStyle::StandardPixmap pixmap = QStyle::SP_DialogOpenButton; bool showDirsOnly = false; switch (m_mode) { case FileSystemPathEdit::Mode::FileOpen: case FileSystemPathEdit::Mode::FileSave: -#ifdef Q_OS_WIN - pixmap = QStyle::SP_DirOpenIcon; -#endif showDirsOnly = false; break; case FileSystemPathEdit::Mode::DirectoryOpen: case FileSystemPathEdit::Mode::DirectorySave: - pixmap = QStyle::SP_DirOpenIcon; showDirsOnly = true; break; default: throw std::logic_error("Unknown FileSystemPathEdit mode"); } - m_browseAction->setIcon(QApplication::style()->standardIcon(pixmap)); + m_browseAction->setIcon(QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon)); m_editor->completeDirectoriesOnly(showDirsOnly); m_validator->setExistingOnly(m_mode != FileSystemPathEdit::Mode::FileSave);