Solved [SOLVED] QFileDialog::getExistingDirectory under windows - directory character
-
I am using QFileDialog::getOpenFileName under Windows and I noticed that the returned file-name looks like
c:/some/path/to/file
.As this might be confusing to the end-user, how do I specify that I would like it in the form of
c:\some\path\to\file
?I hope I don't need to do string-replacement of
/
by\
- that some standard way exists to get the native form of the path to the file. -
You can try
QDir::toNativeSeparators()
i guess.
http://doc.qt.io/qt-4.8/qdir.html#toNativeSeparators -
Thanks, this seems to be the one. I never thought to look in QDir.
I verified the code, and the QDir::toNativeSeparators function will act on any string, not only on directory names, just doing on Windows a very simple-minded replace-string.