Bug 476525 - QFileDialog::filterSelected emitted with wrong value when changing mime filter
Summary: QFileDialog::filterSelected emitted with wrong value when changing mime filter
Status: RESOLVED FIXED
Alias: None
Product: plasma-integration
Classification: Plasma
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-03 23:07 UTC by Nicolas Fella
Modified: 2023-11-07 16:30 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Fella 2023-11-03 23:07:22 UTC
Consider the following code

QFileDialog dlg;
dlg.setMimeTypeFilters({"text/plain", "image/png"});
QObject::connect(&dlg, &QFileDialog::filterSelected, [](const QString &name){
  qWarning() << "changed" << name;
});

Changing the filter in the file dialog UI emits the filterSelected signal.

However when selecting e.g. the PNG filter the name parameter is "image/png", not a QFileDialog filter expression.

Running with another platformtheme, like gtk3, or the builtin file dialog gives "PNG image (*.png)"
Comment 1 Bug Janitor Service 2023-11-03 23:59:16 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-integration/-/merge_requests/116
Comment 2 Marco Martin 2023-11-07 16:30:29 UTC
Git commit 2f94f2af78b55a4e8a9d758101a52ee3f1d14070 by Marco Martin, on behalf of Nicolas Fella.
Committed on 07/11/2023 at 17:29.
Pushed by nicolasfella into branch 'master'.

Adapt to KFileWidget API change

And while at it fix filterSelected for mimetypes

M  +26   -14   qt6/src/platformtheme/kdeplatformfiledialoghelper.cpp

https://invent.kde.org/plasma/plasma-integration/-/commit/2f94f2af78b55a4e8a9d758101a52ee3f1d14070