KDE has its own file manager known as Dolphin. This task will make a little familiar with how the file manager works.
Overview of Task: We will create a file explorer which can help you navigate through files on your computer. This program will be able to show you the only name of file and directories and not able to delete open or modify anything.
- Create new QtWidget project
- Now add a new QListWidget into your MainWindow
- Now create a class object of QDir in MainWindow class(we will refer this object as "dir")
- Create a foreach loop and iterate over drives. This can be achieved with method drives
- Inside this loop add a new item in the list as absoluteFilePath of the current file.
- Exit loop
- Now its time to connect itemDoubleClicked signal of the list with a new custom slot.
- In this new slot function, we will have an argument QListWidgetItem. Now we need to set the text of this item as the path of our dir object.
- Now clear this list with clear method.
- Now again we will loop over all the files and folders with the help of entryInfoList method of dir class.
- Add absoluteFilePath of each file to the list.
- End loop and End of program
- Link to your repository
- Video of your working explorer.
If you can not understand any part or solve any problem contact mentor they are always happy to help.