qt 路径中\\如何变为//
时间: 2023-08-28 20:12:14 浏览: 127
在Qt中,可以使用QString的replace方法将路径中的"\"替换为"/"。例如,如果你的路径是QString path = "C:\\Users\\Desktop\\file.txt",你可以使用path.replace("\\", "/")来将路径中的"\"替换为"/",得到的结果是"C:/Users/Desktop/file.txt"。
#### 引用[.reference_title]
- *1* [QT5快速转换路径(/斜杠与\反斜杠转换)](https://blog.csdn.net/u013541325/article/details/107511050)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [Qt关于路径的处理(绝对路径、相对路径、路径拼接、工作目录、运行目录)](https://blog.csdn.net/qq_41949352/article/details/121717235)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文