一、環境介紹
Qt: 5.12.6
作業系統: win10 (64位)
編譯器: mingw 32

二、功能介紹
使用代碼一鍵打開系統預設浏覽器,使用百度搜尋想要内容,也可以打開百度翻譯自動翻譯内容,也可以打開CSDN搜尋内容等。
三、功能實作
需要使用的頭檔案
#include <QDesktopServices>
#include <QUrl>
一行代碼
QDesktopServices::openUrl(QUrl("https://www.baidu.com/s?ie=UTF-8&wd=我是搜尋的内容"));
運作效果:
其他常用的功能總結:
//百度自動搜尋想要的内容
https://www.baidu.com/s?ie=UTF-8&wd=我是搜尋的内容
//CSDN自動搜尋想要的内容
https://so.csdn.net/so/search?from=chrome_plugin&q=我是搜尋的内容
//打開百度自動翻譯
//中文翻譯
https://fanyi.baidu.com/translate#zh/auto/我就是翻譯的内容
//英文翻譯
https://fanyi.baidu.com/translate#en/auto/我就是翻譯的内容
//英文翻譯
https://fanyi.baidu.com/translate#en/zh/I am the content of translation
//中文翻譯
https://fanyi.baidu.com/translate#zh/en/我就是翻譯的内容
QDesktopServices::openUrl(QUrl("https://so.csdn.net/so/search?from=chrome_plugin&q=DS小龍哥"));