I wanted to specify from a path, whether the item is a file or a folder. How can I implement such function which takes a path (QString
based input) and tells whether it is a file or folder?
You can use the method QFileInfo::isFile()
or QFileInfo::isDir()
to accomplish this.
Example:
QFileInfo fi("/your/path/string");
if (fi.exists() && fi.isFile())
{
//Do stuff...
}