diff options
author | Sérgio Martins <sergio.martins@kdab.com> | 2013-04-29 12:58:23 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-09 14:56:32 +0200 |
commit | 46685f755b01288fd53c4483cb97a22c426a57f0 (patch) | |
tree | b18c0a65dd82dd7717879dafa34e3b04c11c2e4b /src/widgets/dialogs | |
parent | 0e9ea64edcdb451ffcfbf055174354e6c8f2df88 (diff) |
Windows: Introduce QFileDialog::DontUseCustomDirectoryIcons
Folders can have a custom icon, set by the user. Some system
folders also have one, for example c:\windows\fonts.
This option allows you to disable this behavior, you'll get the
folder directory icon.
As a side-effect, you'll get a very big performance improvement
on removable/network media: 2 seconds vs 60 seconds on a SDCard
with 10000 folders.
Change-Id: Id55ea628186e0a6523585ec7a4ff622d6f5da505
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/widgets/dialogs')
-rw-r--r-- | src/widgets/dialogs/qfiledialog.cpp | 14 | ||||
-rw-r--r-- | src/widgets/dialogs/qfiledialog.h | 15 |
2 files changed, 22 insertions, 7 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index e6b6c2b73f..657c8cc7c2 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -255,6 +255,11 @@ Q_WIDGETS_EXPORT _qt_filedialog_save_file_url_hook qt_filedialog_save_file_url_h static functions will always be an application modal dialog. If you want to use sheets, use QFileDialog::open() instead. + \value DontUseCustomDirectoryIcons Always use the default directory icon. + Some platforms allow the user to set a different icon. Custom icon lookup + cause a big performance impact over network or removable drives. + Setting this will enable the QFileIconProvider::DontUseCustomDirectoryIcons + option in the icon provider. This enum value was added in Qt 5.2. */ /*! @@ -754,6 +759,15 @@ void QFileDialog::setOptions(Options options) if (changed & ShowDirsOnly) setFilter((options & ShowDirsOnly) ? filter() & ~QDir::Files : filter() | QDir::Files); + + if (changed & DontUseCustomDirectoryIcons) { + QFileIconProvider::Options providerOptions = iconProvider()->options(); + if (options & DontUseCustomDirectoryIcons) + providerOptions |= QFileIconProvider::DontUseCustomDirectoryIcons; + else + providerOptions &= ~QFileIconProvider::DontUseCustomDirectoryIcons; + iconProvider()->setOptions(providerOptions); + } } QFileDialog::Options QFileDialog::options() const diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h index 2b276be8f1..6b12a00ae6 100644 --- a/src/widgets/dialogs/qfiledialog.h +++ b/src/widgets/dialogs/qfiledialog.h @@ -84,13 +84,14 @@ public: enum Option { - ShowDirsOnly = 0x00000001, - DontResolveSymlinks = 0x00000002, - DontConfirmOverwrite = 0x00000004, - DontUseSheet = 0x00000008, - DontUseNativeDialog = 0x00000010, - ReadOnly = 0x00000020, - HideNameFilterDetails = 0x00000040 + ShowDirsOnly = 0x00000001, + DontResolveSymlinks = 0x00000002, + DontConfirmOverwrite = 0x00000004, + DontUseSheet = 0x00000008, + DontUseNativeDialog = 0x00000010, + ReadOnly = 0x00000020, + HideNameFilterDetails = 0x00000040, + DontUseCustomDirectoryIcons = 0x00000080 }; Q_DECLARE_FLAGS(Options, Option) |