QFileDialog: fix overwritten filter

Consider the following code:
    QFileDialog dlg;
    dlg.setFilter(QDir::Hidden | ...);
    dlg.setOption(QFileDialog::DontUseNativeDialog)

setFilter stores the filter value in QDialogPrivate::options.
setOption will overwrite this value with the default value from
a newly created QFileSystemModel.
The intention was to set the filter in the model to the value in
options.

Change-Id: I561c5cf1ad4d9d729a56620d86ec549eb3105a07
Task-number: QTBUG-37085
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
This commit is contained in:
Joerg Bornemann 2015-02-12 17:07:46 +01:00
parent f11c190c06
commit 3f25eda0ed

View File

@ -2716,7 +2716,7 @@ void QFileDialogPrivate::createWidgets()
return;
Q_Q(QFileDialog);
model = new QFileSystemModel(q);
options->setFilter(model->filter());
model->setFilter(options->filter());
model->setObjectName(QLatin1String("qt_filesystem_model"));
if (QPlatformFileDialogHelper *helper = platformFileDialogHelper())
model->setNameFilterDisables(helper->defaultNameFilterDisables());