Multiple hyperlinks in one label text
Hi guys,
I have this question. I can simply evaluate hyperlink in label text by using linkActivated like in this example:
- label->setText("Some message. <ahref=\" \">Agree</a>");
But is there some way to react on multiple hyperlinks in one label text differently? Let say I have:
- label->setText("Some message. <ahref=\" \">Agree</a>, or you can always <ahref=\" \">Cancel</a>.");
And all I want do do is to connect signal from hyperlink Agree to agree() slot and signal from hyperlink Cancel to cancel() slot.
Thanks ;)
Edit: Please use @ tags around code sections, that also solves your layout issue; Andre
1 reply
The linkActivated() signal passes the clicked link, which makes it rather easy to react differently (given that meaningful link names are provided).
- setText("<a href='agree'>Agree</a>, or you can always <a href='cancel'>Cancel</a>.");
- {
- if (link == "agree")
- {
- agree();
- }
- else if (link == "cancel")
- {
- cancel();
- }
- }
You must log in to post a reply. Not a member yet? Register here!

