Hello, I have a problem here.
I need to filter my QTreeView with certain file criteria.
So far I have this:
QDirModel * TreeModel = new QDirModel;
TempTreeView->setModel( TreeModel );
QDir dir(SourceWidget->getPath() );
TempTreeView->setRootIndex(TreeModel->index(dir.path()));
How can I display only .h and .cpp files in my QTreeView?
Thank you.
Added after 1:
I did filter, but it filters in a strange way. Only these cpp and .h files are shown which are in top level folder. So now the problem is how to make visible the content of subfolders.
QDirModel * TreeModel = new QDirModel;
TreeModel->setReadOnly(false);
TempTreeView->setModel( TreeModel );
QStringList filters;
filters << "*.cpp" << "*.h";
TreeModel->setNameFilters(filters);
TempTreeView->setRootIndex(TreeModel->index( SourceWidget->getPath() ));
Bookmarks