summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qfiledialog.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-02-03 12:45:21 +0100
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-02-22 09:13:04 +0000
commitfc6d5ed18da29138494803baa11c0edc22ace7f4 (patch)
tree54e4dca130bf6b7e8ef0484086c9f46c23a099b4 /src/widgets/dialogs/qfiledialog.cpp
parent6129aade0018437d8d65a0051040d7100c8ec681 (diff)
QFileDialogOptions: Expose default name filter setting.
Move the bool QFileDialogPrivate::defaultFileTypes to QFileDialogOptions as defaultNameFilters and add a static function returning the translated default filter string. Let QFileDialogOptions::nameFilters() return the default filter until a value has been set. This removes the need for special handling for empty filter lists in the QPA plugins. As a side effect, Qt Quick Controls's FileDialog will then also default to "All files" if no filters have been set. Task-number: QTBUG-50644 Change-Id: I9ba271a472d4fa03767b540ef6f1399f5ca4408e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
Diffstat (limited to 'src/widgets/dialogs/qfiledialog.cpp')
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 07422f8811..4d74292e8f 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -532,7 +532,6 @@ QFileDialogPrivate::QFileDialogPrivate()
deleteAction(0),
showHiddenAction(0),
useDefaultCaption(true),
- defaultFileTypes(true),
qFileDialogUi(0),
options(new QFileDialogOptions)
{
@@ -663,8 +662,8 @@ void QFileDialogPrivate::retranslateStrings()
{
Q_Q(QFileDialog);
/* WIDGETS */
- if (defaultFileTypes)
- q->setNameFilter(QFileDialog::tr("All Files (*)"));
+ if (options->useDefaultNameFilters())
+ q->setNameFilter(QFileDialogOptions::defaultNameFilterString());
if (nativeDialogInUse)
return;
@@ -1400,7 +1399,6 @@ QStringList qt_strip_filters(const QStringList &filters)
void QFileDialog::setNameFilters(const QStringList &filters)
{
Q_D(QFileDialog);
- d->defaultFileTypes = (filters == QStringList(QFileDialog::tr("All Files (*)")));
QStringList cleanedFilters;
const int numFilters = filters.count();
cleanedFilters.reserve(numFilters);