SUMMARY QFileDialog has an unnamed name filter, which KDE's file dialog silently ignores. https://doc.qt.io/qt-6/qfiledialog.html#setNameFilter Found during this kialog's bug https://bugs.kde.org/show_bug.cgi?id=467868 STEPS TO REPRODUCE Run this code: ``` #include <QApplication> #include <QFileDialog> int main(int argc, char *argv[]) { QApplication a(argc, argv); // Doesn't work on KDE (only have problem on KDE) auto *dlg1 = new QFileDialog(); dlg1->setNameFilter("*.txt"); dlg1->exec(); // Works auto *dlg2 = new QFileDialog(); dlg2->setNameFilter("Force to work with KDE (*.txt)"); dlg2->exec(); return QApplication::exec(); } ``` OBSERVED RESULT The dlg1's name filter is ignored in KDE :( EXPECTED RESULT It shouldn't SOFTWARE/OS VERSIONS Operating System: Arch Linux KDE Plasma Version: 5.27.5 KDE Frameworks Version: 5.106.0 Qt Version: 5.15.9 Kernel Version: 6.3.5-arch1-1 (64-bit)
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-integration/-/merge_requests/92
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-integration/-/merge_requests/128
Git commit 8a9b3a5d31777920bf551da1bae3cf01167788ff by Nicolas Fella. Committed on 21/12/2023 at 17:22. Pushed by nicolasfella into branch 'master'. Simplify file filter parsing Currently we parse the Qt filter syntax into KDE syntax and then into KFileFilter Cut out the middle step and directly create KFileFilter objects from the Qt filters To parse those use the cleanFilterList helper from QPlatformFileDialogHelper This matches what Qt's GTK file dialog integration does It has the nice side benefit of making nameless filters work M +2 -1 qt6/src/platformtheme/kdeplatformfiledialogbase_p.h M +23 -36 qt6/src/platformtheme/kdeplatformfiledialoghelper.cpp M +4 -1 qt6/src/platformtheme/kdeplatformfiledialoghelper.h M +1 -1 qt6/src/platformtheme/kdirselectdialog.cpp M +1 -1 qt6/src/platformtheme/kdirselectdialog_p.h https://invent.kde.org/plasma/plasma-integration/-/commit/8a9b3a5d31777920bf551da1bae3cf01167788ff
Git commit 925a36a0b49afa3632b1f9e64eaabedb9e3ee6c9 by Nicolas Fella. Committed on 25/12/2023 at 16:56. Pushed by nicolasfella into branch 'master'. Simplify qt2KdeFilter Use the cleanFilterList helper from QPlatformFileDialogHelper This makes nameless filters work M +17 -19 qt5/src/platformtheme/kdeplatformfiledialoghelper.cpp M +1 -0 qt5/src/platformtheme/kdeplatformfiledialoghelper.h https://invent.kde.org/plasma/plasma-integration/-/commit/925a36a0b49afa3632b1f9e64eaabedb9e3ee6c9