Qt 打开指定的文件时间:2023-03-09 03:24:14 最近项目用到使用本地的office打开指定的文件,记录一下代码: QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "/", tr("All Files (*.*)")); QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(fileName).absoluteFilePath())); 不仅可以打开office,貌似能本地打开的都行。