PyQt4 + WebKit

2009-05-30 Thread dudekksoft
Hello,

I need to grab clicked links in QWebView. Everything is fine when I
use linkClicked() signal. LinkDelegationPolicy is set to
DelegateAllLinks and there is a problem. If some site has Javascript
my procedure receives QUrl from linkClicked, next calls:

webView.setUrl(url) #Where "url" is received QUrl

Certainly this method doesn't work. Site loads again (in most cases
it's called http://mywwwsite.net/#). As I use
QWebPage::DelegateExternalLinks it happens the same, because my
procedure grabs links with Javascript. I don't know how to cope with
this problem. Maybe it's possible to set own policy in
QWebPage.LinkDelegationPolicy? Or maybe some other method to grab
protocol, host(if external or not) when user clicks link in webView?

Regards,
Konrad
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyQt4 + WebKit

2009-06-01 Thread dudekksoft
On 31 Maj, 02:32, David Boddie  wrote:
> On Saturday 30 May 2009 17:39, dudekks...@gmail.com wrote:
>
> > I need to grab clicked links in QWebView. Everything is fine when I
> > use linkClicked() signal. LinkDelegationPolicy is set to
> > DelegateAllLinks and there is a problem. If some site has Javascript
> > my procedure receives QUrl from linkClicked, next calls:
>
> > webView.setUrl(url) #Where "url" is received QUrl
>
> > Certainly this method doesn't work. Site loads again (in most cases
> > it's calledhttp://mywwwsite.net/#).
>
> OK, so if I understand correctly, you don't know how to handle these
> special links if you use a delegation policy, and you would prefer it
> if they were handled by WebKit.
>
> > As I use
> > QWebPage::DelegateExternalLinks it happens the same, because my
> > procedure grabs links with Javascript. I don't know how to cope with
> > this problem. Maybe it's possible to set own policy in
> > QWebPage.LinkDelegationPolicy? Or maybe some other method to grab
> > protocol, host(if external or not) when user clicks link in webView?
>
> So, you only want to handle certain links, and pass on to WebKit those which
> you can't handle? Is that correct?
>
> David

Yes, I want to handle external links (out of my host) and links
starting with download://... (my specific protocol).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyQt4 + WebKit

2009-06-05 Thread dudekksoft
On 1 Cze, 22:05, David Boddie  wrote:
> On Monday 01 June 2009 16:16, dudekks...@gmail.com wrote:
>
> > On 31 Maj, 02:32, David Boddie  wrote:
> >> So, you only want to handle certain links, and pass on to WebKit those
> >> which you can't handle? Is that correct?
>
> > Yes, I want to handle external links (out of my host) and links
> > starting with download://... (my specific protocol).
>
> If you want to handle them in a different way to normal Web pages, it seems
> that calling setForwardUnsupportedContent(True) on the QWebPage is the way
> to do it.
>
> However, if you want to handle those links and present the content for the
> browser to render then you may need to override the browser's network access
> manager, as discussed in this message:
>
>  http://lists.trolltech.com/pipermail/qt-interest/2009-March/004279.html
>
> I experimented a little and added an example to the PyQt Wiki:
>
>  http://www.diotavelli.net/PyQtWiki/Usinga Custom Protocol with QtWebKit
>
> I hope it helps to get you started with your own custom protocol.
>
> David

Thank You David for Your help. You made a piece of good work :)
-- 
http://mail.python.org/mailman/listinfo/python-list