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

QFileSystemModel doesn't give list to QCompleter after file system separator is typed

XMLWordPrintable

    • ea9469f2b6b7f78f66c22f391b80b3374a4737ba (5.12, 23.5.2019/5.12.4)

      Use QFileSystemModel to QCompletor. Start writing "C:\" and filelist of c:\Windows\ is not appeared. List appears after remove '\' and re-writing '\'.

      #include <QtWidgets>
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QLineEdit *lineEdit = new QLineEdit;
          QCompleter *completer = new QCompleter(lineEdit);
          QFileSystemModel *fileSystemModel = new QFileSystemModel(completer);
          fileSystemModel->setRootPath("");
          completer->setModel(fileSystemModel);
          completer->setCompletionMode(QCompleter::PopupCompletion);
          completer->setMaxVisibleItems(10);
          completer->setWrapAround(true);
          lineEdit->setCompleter(completer);
          lineEdit->show();
          return a.exec();
      }
      

      For workaround it works fine when using QDirModel instead of QFileSystemModel:

          completer->setModel(new QDirModel(completer));
      

        1. qtbug38014.zip
          2 kB
          Friedemann Kleint
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            kleint Friedemann Kleint
            qtcomsupport Qt Support
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes