QFileSystemModel custom icons?
In my project, I have a QTreeView displaying a location on my drive. I need to change all the icons of the files to a custom icon but leave the folders alone. I reimplemented QFileSystemModel and I was able to change ALL the icons. Any way to limit the change to only files instead of folders? QVariant MyQFileSystemModel::data(const QModelIndex& index, int role) const { if(role == Qt::DecorationRole) return QPixmap(":/icons/TAG_Int.png"); return QFileSystemModel::data(index, role); } This: Becomes: How can I only change the icon of the files? Thanks for your time :) I answered my own question: