How can we create hyper link text in QtGui?
-
Yes, you can use QLabel. You can put rich text (basically, HTML) in it, including links. You will get signals if users hover or click these HTML links. QLabel does not react to other types of user interaction though. You can use those signals to handle the actions internally. If you want a webbrowser to open, set the openExternalLinks property to true as suggested by Iktwo.
-
Connect your slot to "QLabel::linkActivated":http://doc.qt.nokia.com/stable/qlabel.html#linkActivated
-
The linkActivated() signal is not emitted if you set "openExternalLinks":http://doc.qt.nokia.com/stable/qlabel.html#openExternalLinks-prop to true
-
[quote author="cincirin" date="1319184392"]The linkActivated() signal is not emitted if you set "openExternalLinks":http://doc.qt.nokia.com/stable/qlabel.html#openExternalLinks-prop to true[/quote]
Good point :-)Also: it might be useful to check the return value of the connect statement and/or the output of the application. If the return value is false, the connect failed. The debug output of the application should tell you what the cause of that failure is.