1

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.

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

1 Answers1

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