How to select QTreeView items representing QFileSystemModel based on provided path or file name

Viewed 23

I'm struggling to find any information with Python examples on:

  1. how to select the row of QTreeView when delivering the path or the file name of the file related to this row in QFileSystemModel.

The wider context of this is that I want to create a small app using Python and PyQt that will delete duplicated files from my computer.

  1. I have a QTreeView showing files in the selected folder and I want to save them to the list where each item would contain the file name, path and size of each file. Then, it will be compared with a similar list with files' attributes from another folder shown in the second QTreeView. Then duplicates would be identified and the user would be able to select the location from where files would be deleted.

Could someone advise how to solve the first issue and also give me some hints which Qt elements to use to achieve my goals?

I've been fighting with this for 5 weeks already and had to stop in a mid-way since I realized that it is much easier to use QTreeView than QTreeWidget since it provides easy mapping of the file system. I would like to avoid this kind of dead ends in the future.

Thank you for your help and please have mercy since I'm a beginner in Qt.

0 Answers
Related