View Full Version : Clickable weblink
bnilsson
23rd June 2009, 12:06
In my app I have an About.. dialog where I want to put some info plus a couple of web addresses. The web addresses should be clickable so that the standard browser (Explorer, Firefox, Safari) will open the page.
I will not be surprised if this is a very simple thing to set up, but I have not yet found it.
Any clue will be appreciated.
BN
Lykurg
23rd June 2009, 12:15
Please note our Newbie section, if you already know that that is an easy question!
QLabel, QLabel::openExternalLinks, Qt::TextInteractionFlags
bnilsson
23rd June 2009, 12:31
Thank you very much!
bnilsson
23rd June 2009, 13:09
Well, apparently it was not so simple.
QLabel *www1_label;
..
www1_label->setText(Weblink1);
www1_label->setTextInteractionFlags ( Qt::LinksAccessibleByMouse );
www1_label->setOpenExternalLinks(true);
does nothing. The link is not active and nothing happens when clicking on it.
There is no change of cursor when the pointer is pasing over it.
What have I missed?
Is there any example I can look at?
Lykurg
23rd June 2009, 13:55
Well, apparently it was not so simple.
Sure it is. What's the content of Weblink1? I guess you don't use the a tag.
www1_label->setText("<a href=\"http://www.qtcentre.org\">www.qtcentre.org</a>");
aamer4yu
23rd June 2009, 13:58
What is the weblink ?
I tried simply in designer and it works smooth for me.
Also try this -
www1_label->setTextInteractionFlags(www1_label->textInteractionFlags() | Qt::LinksAccessibleByMouse );
bnilsson
23rd June 2009, 18:13
Ok, thanks.
Did you say this tag stuff was documented somewhere in this context?
Sorry that my mind went blank, missing the obvious fact that I had use html syntax.
I will post more on the Newbie forum from here after.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.