[Qt-interest] QWebView linkClicked(url) always null?
Israel Brewster
israel at frontierflying.com
Sun Nov 29 04:00:41 CET 2009
Ok, ugly work-around: I connected the linkHovered signal to a slot
that simply stores the link in a private QString. Then, in the
linkClicked slot, I create a new QUrl using the stored link. Ugly as
all get-up, but it does seem to work. The question remains though: Why
is the linkClicked signal NOT passing a QUrl to my slot?
On Nov 28, 2009, at 5:37 PM, Israel Brewster wrote:
> Is there any way I can debug the Qt source? Such that I can see
> exactly what is being passed to the linkClicked signal? The question
> here is if the signal is being emitted with a null object, or if
> somehow the slot is "loosing" the object. Neither one seems likely,
> but it's got to be something.
>
> On Nov 28, 2009, at 10:03 AM, Israel Brewster wrote:
>
>> 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
>> -----------------------------------------------
>>
>> <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
> -----------------------------------------------
>
> <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/7966f035/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/7966f035/attachment.bin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091128/7966f035/attachment-0001.html
More information about the Qt-interest-old
mailing list