Qt 使用默认程序打开网址、文件夹或者其他文件

1.使用 默认浏览器打开url

QDesktopServices::openUrl(QUrl("http://www.baidu.com"));

2.打开文件夹

QDesktopServices::openUrl(QUrl("file:///C://Users", QUrl::TolerantMode));

3.打开软件(exe等)

QProcess::execute("notepad.exe");

QProcess::execute("explorer c:\\123.txt");

猜你喜欢

转载自blog.csdn.net/xiezhongyuan07/article/details/80938038