View Single Post
marxian's Avatar
Posts: 2,448 | Thanked: 9,523 times | Joined on Aug 2010 @ Wigan, UK
#30
Originally Posted by Copernicus View Post
Unfortunately, clicking on any links within the data will bring them up within the widget; I'm still working out how to pull them up with an external browser.
You can override the default behaviour when clicking on links by setting the 'linkDelegationPolicy' property of QWebPage to QWebPage :: DelegateAllLinks (or QWebPage :: DelegateExternalLinks if you want the QWebView to handle local resources).

Using a QWebView, you can access the QWebPage via the page() function:

Code:
QWebView *view = new QWebView(this);
view->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
QObject::connect(view->page(), SIGNAL(linkClicked(QUrl)), this, SLOT(onLinkClicked(QUrl)));

...

void MyWidget::onLinkClicked(const QUrl &link)
{
    //Handle link
}
__________________
'Men of high position are allowed, by a special act of grace, to accomodate their reasoning to the answer they need. Logic is only required in those of lesser rank.' - J K Galbraith

My website

GitHub
 

The Following 4 Users Say Thank You to marxian For This Useful Post: