Qt C++ - displaying the links in QText Browser
Right now I am displaying the result in QTextBr开发者_Go百科owser
. Results will be something like /home/User/
, /media/Arena/
etc i.e path to different folders. Now I want to open the folder in a window by clicking on this result which is displayed in QTextBrowser
. But I have no ideas how to do that. So can anyone let me know how to do it.
Thanx in advance.
P.S. I am using QtCreator & see the image http://i53.tinypic.com/qyxp1s.png.
can you insert html rather than plain text into the QTextBrowser widget? then you can use a URL to describe the paths.
BasementCat's right. You can use setHtml
QTextBrowser's method to set HTML into the widget. You'll then probably need to call setOpenLinks(false)
to disable default behavior and connect custom slot to widget's anchorClicked(QUrl const&)
signal to handle links.
精彩评论