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));

 

posted @ 2021-08-24 22:00  十一的杂文录  阅读(496)  评论(0编辑  收藏  举报