[Qt-interest] [SOLVED-Mostly] QWebView linkClicked(qurl) always null?
Israel Brewster
israel at frontierflying.com
Mon Nov 30 18:41:46 CET 2009
Finally got it working, if anyone cares. As it turns out, what I had
to do was move the pointer declaration from the function I had it in
(as shown in my original e-mail) to being a class member. Even just
having a class member that I set equal to the pointer I created didn't
work, I had to create (with new) the object using the class member to
store the address, and then use the class member for all the calls I
do, even though I have no need to directly refer to the object outside
of the given function. As this is just a pointer, not an object that
we are talking about, and I never call delete on it (until the program
closes, that is) I have no idea why getting rid of the pointer itself
would be an issue (perhaps something about the way connect works?) but
be that as it may, it does work to actually pass the QUrl, rather than
a null object.
On Nov 28, 2009, at 6:00 PM, Israel Brewster wrote:
> 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
> -----------------------------------------------
>
> <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/20091130/986f96d2/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/20091130/986f96d2/attachment.bin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091130/986f96d2/attachment-0001.html
More information about the Qt-interest-old
mailing list