Qt class for handling file paths


Possible Duplicate:
Qt equivalent of PathAppend?

Is there a class that handles file paths in Qt? Particularly I'm looking for something like .NET's Path.Combine.

I know there's one in boost::filesystem but I was wondering if there's one in Qt.

5/23/2017 12:34:15 PM

Accepted Answer

There is QDir which might be of help (see QDir::relativeFilePath and QDir::canonicalPath and others).

Quoting from QDir doc:

A QDir is used to manipulate path names, access information regarding paths and files, and manipulate the underlying file system.

7/17/2017 8:13:40 AM

Another class that might be useful is QFileInfo.

From Qt documentation:

The QFileInfo class provides system-independent file information.

QFileInfo provides information about a file's name and position (path) in the file system, its access rights and whether it is a directory or symbolic link, etc. The file's size and last modified/read times are also available. QFileInfo can also be used to obtain information about a Qt resource.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow