I have a QListView
that adds a newly added file to a folder using QFileSystemWatcher
, however I also want QListView
to show the icon for that filetype just as QFileSystemModel
would add. I do not want to add any custom icon only the icon that Operating system has registered for the specific to file type.
Asked
Active
Viewed 1,964 times
1

Ciasto piekarz
- 7,853
- 18
- 101
- 197
-
Use `QFileIconProvider::icon(const QFileInfo & info)`. – Pavel Strakhov Sep 26 '15 at 16:10
1 Answers
1
I just figured out how to achieve this using the code below:
fileInfo = QtCore.QFileInfo(path)
iconProvider = QtGui.QFileIconProvider()
icon = iconProvider.icon(fileInfo)

Ciasto piekarz
- 7,853
- 18
- 101
- 197