使用QDir::fromNativeSeparators 示例: 12QString path = "C:\\temp/test.txt";path = QDir::fromNativeSeparators(path); 输出 1C:/temp/test.txt # Qt