Displaying just the files with correct extension
-
29-10-2019 - |
Question
I'm trying in QFileSystemModel display just files with extention *.txt
and the other types shaded/grayed out:
proxy_
is of type QSortFilterProxyModelmodel_
is of type QFileSystemModel
Here's my code:
proxy_->setFilterWildcard("*.txt");
proxy_->setSourceModel(model_);
model_->setNameFilters(QStringList(proxy_->filterRegExp().pattern()));
model_->setNameFilterDisables(true);
sel_model_ = (new QItemSelectionModel(proxy_));
treeView->setModel(proxy_);
treeView->setSelectionModel(sel_model_);
...but by doing so nothing is shown in my view. Anyone knows what I'm doing wrong?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow