Skip to content

FileChooser: Properly preselect MIME filter passed as "current_filter"

This fixes the preselection of a MIME type filter passed as current_filter.

Other than the KFileWidget::setFilter case, calling KFileWidget::setMimeFilter does not select the first filter in the list, but takes an explicit (optional) parameter which of the filters to preselect, "otherwise, a first item showing all the mimetypes will be created". (https://api.kde.org/frameworks/kio/html/classKFileWidget.html#acdb884df2e08aa11c92adc1f96b6b2c1)

In order to test this, the sample program from QTBUG-85658 can be used (together with a Qt version that contains the fix for that one).

In step 6 of the steps to reproduce described there, "plain text document, PDF document" is preselected in the file dialog without this fix here present, whereas it should be just "plain text document".

Merge request reports

Loading