#include <QDesktopServices>
QDesktopServices::openUrl(QUrl(QLatin1String(“http://blog.const.net.cn”)));
如下代码所示:
ui->label_csdn->setOpenExternalLinks(true);
ui->label_csdn->setText("<a style='color: green;' href=\“https://blog.youkuaiyun.com/weixin_42887343\”>https://blog.youkuaiyun.com/weixin_42887343");
qt界面超链接一般使用QLabel作为控件,点击后启动浏览器打开该网页。

其中上图中,左边框为访问的网页,右边框为label显示的内容。

原文:
https://blog.youkuaiyun.com/weixin_42887343/article/details/115763775
QT点击按钮打开一个网址URL
QDesktopServices::openUrl(QUrl(QLatin1String(“http://blog.const.net.cn”)));
第一次打开的时候好像要比较长时间,第二次打开时就会很快速。
bool QDesktopServices::openUrl ( const QUrl & url ) [static]
从上面声明可以看了,该函数为静态函数,可直接使用,但需要引用头文件。
#include <QDesktopServices>
https://blog.youkuaiyun.com/u012260238/article/details/53228052