Nominate our 2022 Qt Champions!

QSortFilterProxyModel dont filter my treeview

  • I used this code to my treeview display folders in my hard drive and this code works fine:

    QString sPath = "E:/";

    dirModel = new QFileSystemModel(this);
    dirModel->setFilter(QDir::NoDotAndDotDot | QDir::AllDirs);


    Now I want to add filter to above code and I wrote this code for that purpose, but it show me an empty treeview while I have "clips" folder in my root of E:/ drive. Am I doing something wrong? Thank you for help

    QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this);

    proxyModel->setFilterRegExp(QRegExp("clips", Qt::CaseInsensitive, QRegExp::FixedString));


Log in to reply