views:

35

answers:

2

In the "About box" of my software, I used a QGraphicsTextItem to show the about-text.

This text contains hypertext links (in the form of: <a href="http://some.random.site"&gt;link&lt;/a&gt;).

The item shows up properly (hypertext links are blue and underlined). However, when I click on them, nothing happens.

Here is how I created the QGraphicsTextItem:

d_about_text_item = new QGraphicsTextItem;
d_about_text_item->setTextInteractionFlags(Qt::TextBrowserInteraction);
d_about_text_item->setHtml(aboutText());

As I understand the Qt documentation, the call to setTextInteractionFlags should allow me to handle special hypertext links click events.

Is there anything else I should do to be able to click on the links and show up the linked page in the default system browser ?

+2  A: 

I found what I did wrong:

My containing QGraphicsView had setInteractive() set to false. I removed it and since now, it works fine.

ereOn
A: 

FWIW I use the standard QMessageBox::about method and simply pass raw HTML as the text - links work fine.

QMessageBox::about(this, tr("About"), tr("<h1>My App</h1><p><a href='www.stackoverflow.com'>Click me!</a></p>"));
Rob