Qt 桌面服务 QDesktopServices

使用浏览器打开网址

#include <QDesktopServices>
#include <QUrl>

QUrl url(QString("https://cn.bing.com"));
QDesktopServices::openUrl(url);

打开本地文件夹

#include <QDesktopServices>
#include <QUrl>

QString filePath = QString("D:");
QString path = QString("file:///") + filePath;
QDesktopServices::openUrl(QUrl(path, QUrl::TolerantMode));
原文地址:https://www.cnblogs.com/shiyixirui/p/15182748.html