QDirModel (filter files, custom Icon, look)
Hi,
This is my first post.....:)
Code:
model->setReadOnly(true);
model
->setSorting
(QDir::DirsFirst |
QDir::IgnoreCase |
QDir::Name);
model
->setFilter
(QDir::Dirs |
QDir::Files |
QDir::NoDotAndDotDot);
treeView->setModel(model);
treeView->setRootIndex(model->index(dir.path()));
The above code is working fine. I need to do three more things. The further directory structure inside ("node") directory consists more directories with (.xml,.bmp,.txt) files.
How do I edit QDirModel so that:
1. It should only shows directories and ".xml" files only.
2. Every ".xml" file has equivalent ".bmp" file in the same directory. For e.g. "tree.xml" & "tree.bmp". By default ".xml" files shows system's icon. I need to show the ".bmp" icon
instead of default icon.
3. I don't need the header with colums (Name, Size, Type etc.)
Regards
Prashant
Re: QDirModel (filter files, custom Icon, look)
Subclass QSortFilterProxyModel, filter out the entries you don't need and reimplement the data() method to return proper icons. Then position your proxy model between the source model and the view.