When I use
QString mydir = QFileDialog::getExistingDirectory(this, "Select the directory","/Home");
I get path as D:\Myfolder but I need it in unix style i.e like this D:/Myfolder, how can I do this?
When I use getfilename(used to get filepath) then it is in my favour i.e in unix style but why Qt Engineers didn’t do the same for getExistingDirectory? Is there any workaround for this?
I m on Windows 7
You can use QDir::fromNativeSeparators() to convert it to unix style. I do that in my projects.
For example:
QString myUnixPath = QDir::fromNativeSeparators("C:\\some\\path\\");