Bug 359528

Summary: QFileDialog::selectedNameFilter returns a different value from what was set using QFileDialog::selectNameFilter
Product: [Frameworks and Libraries] frameworks-frameworkintegration Reporter: Arjen Hiemstra <ahiemstra>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs-null>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Example code to reproduce the issue

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.