Unsolved Get a list of files and folders in a particular directory
-
I am trying to access the files and folders in a particular directory, that is the file names, file icon, etc. please can anyone tell me how to do this?
Thanks.
-
Hi and welcome
Have a look at
http://doc.qt.io/qt-5/qdiriterator.htmlQDirIterator it(dir, QStringList() << "*.jpg", QDir::Files, QDirIterator::Subdirectories);
while (it.hasNext())
qDebug() << it.next();for the icon, i think you can use
http://doc.qt.io/qt-5/qfileiconprovider.html#details -
U can get file name using below code.
QFile file("fileName.txt");
QFileInfo fileInfo(file.fileName());
QString filename(fileInfo.fileName());