使用浏览器打开网址
#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));