Bug 359528 - QFileDialog::selectedNameFilter returns a different value from what was set using QFileDialog::selectNameFilter
Summary: QFileDialog::selectedNameFilter returns a different value from what was set u...
Status: REPORTED
Alias: None
Product: frameworks-frameworkintegration
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-18 11:12 UTC by Arjen Hiemstra
Modified: 2021-03-09 05:54 UTC (History)
0 users

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


Attachments
Example code to reproduce the issue (383 bytes, text/x-python)
2016-02-18 11:13 UTC, Arjen Hiemstra
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arjen Hiemstra 2016-02-18 11:12:50 UTC
See the attached code example.

When creating a QFileDialog with several name filters that have the same extension, calling QFileDialog::selectedNameFilter after QFileDialog::exec will return the first entry with that extension rather than the actual selected filter. I believe this is due to the conversion from Qt's name filters to what the KDE file dialog expects.

Note that QFileDialog::selectNameFilter does seem to do the right thing, since the correct file type filter is selected on opening the dialog.

Reproducible: Always

Steps to Reproduce:
1. Run the attached code (needs PyQt5)
2. Observe the printed selected filter name

Actual Results:  
"Test File Type (*.test)" is printed.

Expected Results:  
"Another Test File Type (*.test)" is printed.
Comment 1 Arjen Hiemstra 2016-02-18 11:13:31 UTC
Created attachment 97280 [details]
Example code to reproduce the issue
Comment 2 Justin Zobel 2021-03-09 05:54:05 UTC
Thank you for the bug report.

As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists.

If this bug is no longer persisting or relevant please change the status to resolved.