[SOLVED] How to use what's this links?
-
I'm using Qt 4.8 with Qt Creator for a project and have encountered a What's this behavior that I don't understand.
After designing a dialog box I create a what's this property by clicking on the ... button on the WhatsThis property box. This creates an edit box to enter my text and other information. This all works great except for the link button on the edit box. Inspecting the source indicates that the link is formed in the normal manner by enclosing some text in an anchor element as follows
@<a href="url">some text</a>@
All this seems straightforward but the problem is how does this link work? Clicking on the link does nothing. I cannot seem to find a signal that is emitted when the link is clicked. I suppose that at some point one could use:
@bool QDesktopServices::openUrl ( const QUrl & url )@
if I could figure out how to connect to it.
The basic question is;
How do you get a link in the WhatsThis box to work?MY SOLUTION;
After some research I am using the following solution:
I re-implemented the QDialog event function as follows
@bool SimpleElementInsertDialog::event(QEvent *e)
{
// reimplement event processing
if(e->type()==QEvent::WhatsThisClicked)
{
QWhatsThisClickedEvent ce = static_cast<QWhatsThisClickedEvent>(e);
QDesktopServices::openUrl(QUrl(ce->href()));
return true;
}
return QDialog::event(e);
}// end reimplemented event@Where SimpleElementInsertDialog is my dialog widget (a subclass of QDialog). A bit obscure (for me) to find the solution but it seems to work however since I am not used to processing events in this manner I'd appreciate any comments or corrections that may apply.