View Full Version : QWebView - opening links in external browser?

9th August 2010, 21:03
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:


webWidget = new QWebView(this);

webWidget->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );

connect(webWidget, SIGNAL(linkClicked (const QUrl &)), this, SLOT(urlClicked(const QUrl &)));
void App::urlClicked(QUrl & link)
qDebug() << link.toString();
and in App.h,the slot

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.

27th September 2010, 14:21
implement the createwindow of the qwebpage class..