Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-47923

Widgets-based QFileDialog does not display files matching *.txt when setting mime type to "text/plain"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 5.6.0 RC
    • 5.6.0 Alpha
    • None
    • XCB,Windows
    •  2117a76136e6e3e48f70d7a444b06c0ee0ff9ec4 (qtbase/5.6, 28.8.2015, 5.6)

      • touch a foo.txt and foo.html
      • Run the sample program
      • Note foo.txt is not shown whereas foo.html is when switching the filter to HTML
        #include <QApplication>
        #include <QFileDialog>
        #include <QMimeDatabase>
        #include <QDebug>
        
        int main(int argc, char *argv[])
        {
            QApplication a(argc, argv);
        
            QFileDialog fileDialog(0, "Open File...");
            fileDialog.setOption(QFileDialog::DontUseNativeDialog);
            fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
            fileDialog.setFileMode(QFileDialog::ExistingFile);
            fileDialog.setMimeTypeFilters(QStringList() << "text/plain"<< "text/html");
            fileDialog.exec();
            qDebug() << QT_VERSION_STR << fileDialog.selectedFiles();
            return 0;
        }
        

        Found while working on https://codereview.qt-project.org/#/c/124202/

        1. qtbug47923_diag.diff
          4 kB
        2. qtbug47923_log.txt
          2 kB
        3. qtbug47923.zip
          1.0 kB
        For Gerrit Dashboard: QTBUG-47923
        # Subject Branch Project Status CR V

            kleint Friedemann Kleint
            kleint Friedemann Kleint
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes