QWebView - opening links in external browser?
I can't seem to be able to figure out how to get this work.
I have a webview in my app, and I want every link clicked on it to open in the system's default browser. The app lets the user choose one from a list of URLs and displays a small description webpage of said url, which has a link to the actual website. I want this link to be opened in an external browser.
This is what I have, regarding the problem:
App.cpp:
Code:
webWidget = new QWebView(this);
webWidget->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
connect(webWidget,
SIGNAL(linkClicked
(const QUrl &)),
this,
SLOT(urlClicked
(const QUrl &)));
Code:
void App
::urlClicked(QUrl & link
) {
qDebug() << link.toString();
}
and in App.h,the slot
Code:
void urlClicked
(QUrl & link
);
But since the QUrl never gets sent to the slot(the debug line doesn't print anything), I'm assuming I'm missing something, but haven't been able to figure out what it is.
Re: QWebView - opening links in external browser?
implement the createwindow of the qwebpage class..