How to change icons of QFileSystemModel ?
System: Deepin Linux
Source Code: https://github.com/sonichy/HTYFileManager
@sonichy Could you please ask a more specific question?
Or do you expect others to read your source-code and try to find out or guess what the problem is?
@sonichy Hi, friend, welcome. what's system you used ? are you from china?
@sonichy Hi, I saw the code. This project is not complicated. so, if you watched the code, and debug it. you will know the way, how to change the icons. Please read the code carefully.
@jsulm Queston is specific: How to change icon after QFileSystemModel bind to system directory. To realize image preview.
@joeQ I wrote the code, I am looking for a solution to this issue.
@sonichy oh, sorry, i misunderstood you.let's help you. Friend, Are you come from Jiuzhaigou in Sichuan Province ?
QIcon QFileSystemModel::fileIcon(const QModelIndex &index) const Returns the icon for the item stored in the model under the given index.
we can get the
QModelIndex. How to set the
would you try
@sonichy Also use the
void QFileSystemModel::setIconProvider(QFileIconProvider *provider) Sets the provider of file icons for the directory model.
Try it again.
Queston is specific: How to change icon after QFileSystemModel bind to system directory. To realize image preview.
Next time please describe more details in your post, we do not have supernatual power, it is hard to guess what do you want to do. Your problem may seem obvious to yourself, but usually this is not true for other, that is why we need to give more information when asking questions.
If you want to post your codes and expect us to read it, please make a minimal one, make your classes, functions as short as possible(I believe most of us think small classes and functions easier to read than large one), do not put all of the codes at once. Your long classes and functions may seem clear for you within 3 months, but not for other.