The below code, for example returning the selected folder path as “C:/Users/guest/Desktop/MyWork”
I need to pass this path to an sql which compare the existing path “C:\Users\guest\Desktop\MyWork”.
Since both the paths containing different type of slashes, sql query is not working as expected.
Is there any way to return the path with backward slashes (‘\’) using the below code.
QString path= QFileDialog::getExistingDirectory(0, tr("Restore Files..."), "/home", QFileDialog::ShowDirsOnly | QFileDialog::DontUseNativeDialog);
To convert slashes:
You can either call this function on the string you get back from your sql database, or (my preference) you can store it in your database with the slashes already converted.