https://bugs.kde.org/show_bug.cgi?id=516399

            Bug ID: 516399
           Summary: QFileDialog: Warning
                    "kf.kio.filewidgets.kfilefiltercombo: Could not find
                    file filter" when calling selectNameFilter() before
                    show()/exec()
    Classification: Plasma
           Product: plasma-integration
      Version First master
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

When using a native KDE file dialog via QFileDialog (with the KDE platform
theme/plugin active), calling selectNameFilter() or selectMimeTypeFilter()
immediately after setNameFilters() / setMimeTypeFilters() — but before show()
or exec() — triggers warning in the console:

kf.kio.filewidgets.kfilefiltercombo: Could not find file filter "..."

The filter is eventually applied correctly after the dialog is shown, but the
warning appears due to a timing issue: Qt invokes the selection method right
away, while KDE's KFileFilterCombo only populates the filter list later during
dialog initialization (initializeDialog() → setFilters()).

Steps to Reproduce


#include <QApplication>
#include <QFileDialog>

int main(int argc, char *argv[]) {
    QApplication app(argc, argv);

    QFileDialog dialog(nullptr);
    dialog.setNameFilters({
        "Text files (*.txt)",
        "Images (*.png *.jpg *.jpeg)",
        "All files (*)"
    });

    // This line triggers the warning on KDE/Plasma
    dialog.selectNameFilter("Images (*.png *.jpg *.jpeg)");

    dialog.exec();  // or dialog.show() + app.exec()

    return app.exec();
}

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to