Hi, I found that QSortFilterProxyModel can't filter properly when it works with QFileSystemModel. Sometimes it left NOTHING in the view. Can anyone point out where I'm wrong?

Just create a simple GUI example:

Qt Code:
  1. MainWindow::MainWindow(QWidget *parent) :
  2. QMainWindow(parent),
  3. ui(new Ui::MainWindow)
  4. {
  5. ui->setupUi(this);
  6. QFileSystemModel *fsm = new QFileSystemModel(this);
  7. fsm->setRootPath(".");
  8.  
  9. sfpm->setDynamicSortFilter(true);
  10. sfpm->setSourceModel(fsm);
  11. sfpm->setFilterRegExp(QRegExp(".cpp", Qt::CaseInsensitive,
  12. QRegExp::FixedString));
  13. sfpm->setFilterKeyColumn(0);
  14.  
  15. ui->tableView->setModel(sfpm);
  16.  
  17. ui->tableView->setRootIndex(sfpm->mapFromSource(fsm->index(".")));
  18.  
  19.  
  20. }
To copy to clipboard, switch view to plain text mode 

if you comment out the setFilterRegExp statement, sure the files in current path are shown in the view. I've also tried setFilterWildcard and other RegExp, nothing works. Very frustrating.