Can Qt build "paths" ?
Unsolved
General and Desktop
-
Internally Qt uses
/
as path separator, but all path taking APIs accept both/
and\
, so you can just always use/
(which is easier because you don't have to escape it).
If you need to pass the path to some native platform API or display it to the user in a platform correct form you can use QDir::toNativeSeparators, which will convert all the separators to current platform appropriate.
It's usually not needed, but if you insist on building the platform correct path yourself you can use QDir::separator().So both of those will do the same:
QString path1 = QDir::toNativeSeparators("\\this/is\\my/fancy\\path"); QChar sep = QDir::separator(); QString path2 = sep + "this" + sep + "is" + sep + "my" + sep + "fancy" + sep + "path".