我使用的是QTextBrowser,并使用link进行如下设置:
QString url =
"http://developer.qt.nokia.com/doc/qt-4.8/qtextbrowser.html#source-prop";
textBrowser->setOpenExternalLinks(true);
textBrowser->setHTML(url);或通过以下方式:
textBrowser->setSource(QUrl(url));或者甚至是:
QString u = "<a href=\""+url+"\">"+url+"</a>";
textBrowser->setHTML(u);但是什么也没发生。如果我添加setSource,我甚至看不到字体。
发布于 2012-01-24 15:24:52
您已经使用了
textBrowser->setHTML(url);但它实际上不是用于创建链接的有效HTML。您需要使用a href。请看这里支持的html子集。
https://stackoverflow.com/questions/8983282
复制相似问题