[Qt-interest] QWebView linkClicked(url) always null?

Israel Brewster israel at frontierflying.com
Sat Nov 28 20:03:03 CET 2009


Some additional info:

Just to clarify, when I say NULL QUrl, I mean the address of the QUrl  
object is NULL, not that I have a valid QUrl object with a NULL url or  
the like. This means that I can't even check for this case in my code,  
because even something like calling QUrl.isValid() will cause a crash- 
since there is no QUrl object to call it on.

These same links that cause problems, when I have linkDelegation  
turned off, load fine in the QWebView, so I know they are valid links.  
There is nothing special about the HTML that creates the link either -  
for example, one of the links is defined thus (if the code makes it  
through):

<a href="http://mactimeclock.sf.net/">webpage</a>

so nothing fancy there. So I'm at a total loss as to why the signal  
would be emitted with a NULL QUrl. At least I assume the problem is on  
the emitting side- I can't think of anything that would cause the slot  
to drop the argument passed to it.

This is now using the pre-compiled Qt 4.5.3 binaries to eliminate any  
possible problems from the way I compiled- they won't work for  
deployment of my application, but there fine for testing certain  
portions.

Thanks for any help that can be provided!

On Nov 27, 2009, at 5:23 PM, Israel Brewster wrote:

> I have the following code in my program:
>
>  QWebView * helpWindow=new QWebView;
> .
> . //find the file to load here
> .
> helpWindow- 
> >load(QUrl("file://"+documentationLocation.absolutePath()));
> helpWindow->page()- 
> >setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
> connect 
> (helpWindow 
> ,SIGNAL(linkClicked(QUrl)),this,SLOT(externalLinkClicked(QUrl)));
>
> This much seems to work well, and when an external link is clicked,  
> the function externalLinkClicked(QUrl) is called. However, for some  
> reason the QUrl is invariably null - which, of course, causes  
> problems the moment I try to do anything with it. What am I missing  
> here? How can I get the signal to actually pass the URL? Thanks.
> -----------------------------------------------
> Israel Brewster
> Computer Support Technician II
> Frontier Flying Service Inc.
> 5245 Airport Industrial Rd
> Fairbanks, AK 99709
> (907) 450-7250 x293
> -----------------------------------------------
>
> <Israel Brewster.vcf>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest

-----------------------------------------------
Israel Brewster
Computer Support Technician II
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091128/1ba780ee/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Israel Brewster.vcf
Type: text/directory
Size: 417 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091128/1ba780ee/attachment.bin 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091128/1ba780ee/attachment-0001.html 


More information about the Qt-interest-old mailing list