Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSortFilterProxyModel dont filter my treeview
Forum Updated to NodeBB v4.3 + New Features

QSortFilterProxyModel dont filter my treeview

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 593 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    masoudk
    wrote on last edited by
    #1

    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);
    dirModel->setRootPath(sPath);
    
    ui->treeView->setModel(dirModel);
    

    @

    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->setSourceModel(dirModel);
    proxyModel->setFilterRegExp(QRegExp("clips", Qt::CaseInsensitive, QRegExp::FixedString));
    
    ui->treeView->setModel(proxyModel);
    

    @

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved