QFileInfo file("path/to/file.txt"); if(file.isReadable()){ // do something with the readable file }
QDir dir("path/to/directory"); QFileInfoList files = dir.entryInfoList(); for(QFileInfo file: files){ if(file.isReadable()){ // do something with the readable file } }This code creates a QDir object for a directory and retrieves a list of all its files using the entryInfoList function. Then, it loops through the file list and checks if each file is readable. If it is readable, it executes some code. Package Library: QFileInfo is a class from the Qt Core library. Therefore, to use it, you need to include the QtCore module in your project. The header file to include is