KDE Community

Tutorial 2 - Creating a file explorer

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.

Prerequisites: Basic knowledge of QT classes QDir, QListWidget and QFileInfo

Steps:

  1. Create new QtWidget project
  2. Now add a new QListWidget into your MainWindow
  3. Now create a class object of QDir in MainWindow class(we will refer this object as "dir")
  4. Create a foreach loop and iterate over drives. This can be achieved with method drives
  5. Inside this loop add a new item in the list as absoluteFilePath of the current file.
  6. Exit loop
  7. Now its time to connect itemDoubleClicked signal of the list with a new custom slot.
  8. 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.
  9. Now clear this list with clear method.
  10. Now again we will loop over all the files and folders with the help of entryInfoList method of dir class.
  11. Add absoluteFilePath of each file to the list.
  12. End loop and End of program

Submission:

  • 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.

Task tags

  • file explorer
  • dolphin
  • gui
  • c++
  • qt

Students who completed this task

pranav, Tux, triplequantum, waleko, TURX, Rohan2003, Sheogorath, Terence, BrettyJames, Ivan Fonseca, UA, Smehnov

Task type

  • code Code
  • chrome_reader_mode Documentation / Training
close

2018