summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2014-03-11 15:56:26 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-17 16:27:55 +0100
commitf6d3b65e455272d259f98cb900f46c8de765e174 (patch)
tree8fe1e07d946949373a0e7ea7bc8a6f82d2838886
parenta1a2a038db4c67add9350edf900583323c9cff5b (diff)
QFileDialog: documentation clarifications about file type filtering
*.* is not a portable file type filter. Anyway it's better to filter by mime types, because it's more inclusive now and may even get better in the future. Task-number: QTBUG-37393 Change-Id: Ide3c3dfc47cd4b4c55d842b73de5369a0596a546 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index bb73ef5cda..80e8d152ff 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -1313,13 +1313,13 @@ QStringList qt_make_filter_list(const QString &filter)
Sets the filter used in the file dialog to the given \a filter.
If \a filter contains a pair of parentheses containing one or more
- of \b{anything*something}, separated by spaces, then only the
+ filename-wildcard patterns, separated by spaces, then only the
text contained in the parentheses is used as the filter. This means
that these calls are all equivalent:
\snippet code/src_gui_dialogs_qfiledialog.cpp 6
- \sa setNameFilters()
+ \sa setMimeTypeFilters(), setNameFilters()
*/
void QFileDialog::setNameFilter(const QString &filter)
{
@@ -1373,7 +1373,19 @@ QStringList qt_strip_filters(const QStringList &filters)
Sets the \a filters used in the file dialog.
+ Note that the filter \b{*.*} is not portable, because the historical
+ assumption that the file extension determines the file type is not
+ consistent on every operating system. It is possible to have a file with no
+ dot in its name (for example, \c Makefile). In a native Windows file
+ dialog, \b{*.*} will match such files, while in other types of file dialogs
+ it may not. So it is better to use \b{*} if you mean to select any file.
+
\snippet code/src_gui_dialogs_qfiledialog.cpp 7
+
+ \l setMimeTypeFilters() has the advantage of providing all possible name
+ filters for each file type. For example, JPEG images have three possible
+ extensions; if your application can open such files, selecting the
+ \c image/jpeg mime type as a filter will allow you to open all of them.
*/
void QFileDialog::setNameFilters(const QStringList &filters)
{