• 使用QDir::fromNativeSeparators

  • 示例:

1
2
QString path = "C:\\temp/test.txt";
path = QDir::fromNativeSeparators(path);
  • 输出
1
C:/temp/test.txt