Creating a Directory Viewer GUI

Learn how we can use the QFileSystemModel module to create a directory viewer.

The directory viewer GUI

Every operating system must have a way for users to access the data and files stored there. These files are kept in a hierarchical file system, which groups drives, directories, and files so that you can only view the ones you're interested in. Whether you use a command-line interface or a graphical user interface, there must be a way to add, delete, and rename files and directories. However, finding the files or directories you need within your current application may be more convenient than opening new windows or other programs if you are already interacting with one interface.

This project demonstrates how to set up an interface for browsing local system files. Two important classes will be introduced in this project: QTreeView, which offers a visual representation of data using a treelike structure, and QFileSystemModel, which gives you access to the file system on your computer.

Firstly, we start by importing the modules that are required for the application.

Get hands-on with 1400+ tech skills courses.