Important: Please read the Qt Code of Conduct -

QFileSystemModel should support QRegExp Filter

  • Not only Wildcard, but also RegExp.
    I have found it hard to hide the backup files whose name is like "~anyfile.txt","#anyfile.txt" and etc.

  • Moderators

    Have you tried using a QSortFilterProxyModel? As the name implies it is the recommended way to sort and filter other models before they are displayed in a view.

  • I haven't used QSortFilterProxyModel before. Let me try it.

    Thank you very much!

  • It is very convenient to use QSortFilterProxyModel.

    But new problem emerged...

    QFileSystemModel::index() will generate modelIndex which haven't created yet. QSortFilterProxyModel do not know the new created modelIndex node. So when I try to use :

    @QModelIndex index = _proxyModel->mapFromSource(_mode->index(strDirPath));

    myView->scrollTo(index, QAbstractItemView::PositionAtCenter);@

    It is crashed in "scrollTo". index is valid ,but parent of index is not valid.

  • I have found way to solve this problem:

    reset the relationship of proxymodel and sourcemodel

Log in to reply