[Qt-interest] Launching new browser from within QtWebKit
sarvesh saran
aquarian.thunder at gmail.com
Sun Jan 16 07:01:37 CET 2011
Hi,
I remember facing this same issue a long time ago. You can try the following
:
webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
connect(webView, SIGNAL(linkClicked(const QUrl&)), this, SLOT
(onUrlClicked(const QUrl&)));
in the slot, use QDesktopServices::openUrl to open the url in your default
browser:
http://doc.trolltech.com/4.5/qdesktopservices.html#openUrl
( if using Linux, you can try and check if $BROWSER env variable is
set...and then use QProcess to open that browser, passing the Url as a
command line arg)
thanks,
Sarvesh Saran
On Sun, Jan 16, 2011 at 5:58 AM, Darryl Hunter <
darryl.hunter at codersoft.com.au> wrote:
> Hi all,
>
>
>
> I'm using Qt 4.7.1, on Windows 7. My application has a QWebView in it,
> which has loaded a page from my server. I want to have a link that, when
> clicked, opens the users default browser to show the page, rather than
> opening it within the QWebView.
>
>
>
> I set target="_blank" on the page, and it works fine when I test it within
> Internet Explorer (a new copy of IE is launched), but when I follow the link
> within the QWebView, nothing happens. If I don't have the target="_blank"
> then it follows the link as you would expect (within the QWebView).
>
>
>
> Is there a setting I need to enable to make this happen? I couldn't see
> anything in QWebSettings that appeared relevant.
>
>
>
> Any help / suggestions would be greatly appreciated.
>
>
>
> Regards,
>
>
>
> Darryl
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110116/7e68042a/attachment.html
More information about the Qt-interest-old
mailing list