Qt-interest Archive, May 2007
QTextBrowser - setSource pointing to resource
Message 1 in thread
Hi all. I have an html file that's pointed to within my .qrc file
with the correct path. The resource file looks something like this:
<RCC>
<qresource prefex="/">
<file>images/question.png</file>
<file>docs/index.html</file>
</qresource>
</RCC>
Following the instructions in http://doc.trolltech.com/4.2/
qtextbrowser.html#details , I do the following:
QTextBrowser foo(...);
foo.setSource("qrc:/docs/index.html");
It doesn't seem to find the file - the html reverts to the default
for this widget. I have no trouble accessing the image referenced in
the qrc file using ":/images/question.png".
Has anyone had any success with this particular invocation?
Thanks.
--
[ signature omitted ]
Message 2 in thread
shouldn't it read like this?
<qresource prefix="/" >
your way to spell it looks wrong to me.
does fixing this help?
Peter
> -----Original Message-----
> From: Bruno Trindade [mailto:bruno@xxxxxxxxx]
> Sent: Thursday, May 17, 2007 8:05 PM
> To: Qt-interest
> Subject: QTextBrowser - setSource pointing to resource
>
> Hi all. I have an html file that's pointed to within my .qrc file
> with the correct path. The resource file looks something like this:
>
> <RCC>
> <qresource prefex="/">
> <file>images/question.png</file>
> <file>docs/index.html</file>
> </qresource>
> </RCC>
>
> Following the instructions in http://doc.trolltech.com/4.2/
> qtextbrowser.html#details , I do the following:
>
> QTextBrowser foo(...);
>
> foo.setSource("qrc:/docs/index.html");
>
>
> It doesn't seem to find the file - the html reverts to the default
> for this widget. I have no trouble accessing the image referenced in
> the qrc file using ":/images/question.png".
>
> Has anyone had any success with this particular invocation?
>
> Thanks.
--
[ signature omitted ]
Message 3 in thread
Hi Bruno,
Silly question, but did you initialize your resource?
Q_INIT_RESOURCE(RCC-filename);
-K.
Bruno Trindade wrote:
> Hi all. I have an html file that's pointed to within my .qrc file
> with the correct path. The resource file looks something like this:
>
> <RCC>
> <qresource prefex="/">
> <file>images/question.png</file>
> <file>docs/index.html</file>
> </qresource>
> </RCC>
>
> Following the instructions in
> http://doc.trolltech.com/4.2/qtextbrowser.html#details , I do the
> following:
>
> QTextBrowser foo(...);
>
> foo.setSource("qrc:/docs/index.html");
>
>
> It doesn't seem to find the file - the html reverts to the default for
> this widget. I have no trouble accessing the image referenced in the
> qrc file using ":/images/question.png".
>
> Has anyone had any success with this particular invocation?
>
> Thanks.
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
--
[ signature omitted ]
Message 4 in thread
Thanks for all your responses. The "prefex" thing was just a typo in
my email - it's correct in the file. I'm not explicitly calling
Q_INIT_RESOURCE anywhere in my code - I didn't have to for the
images. I also don't get any error output saying it could not find
the resource.
I've gotten around this for now by not including the html file as a
resource but referencing it in the filesystem instead.
Thanks for your help!
-Bruno
On May 18, 2007, at 7:14 AM, Kavindra Palaraja wrote:
> Hi Bruno,
> Silly question, but did you initialize your resource?
>
> Q_INIT_RESOURCE(RCC-filename);
>
>
> -K.
>
> Bruno Trindade wrote:
>> Hi all. I have an html file that's pointed to within my .qrc file
>> with the correct path. The resource file looks something like this:
>>
>> <RCC>
>> <qresource prefex="/">
>> <file>images/question.png</file>
>> <file>docs/index.html</file>
>> </qresource>
>> </RCC>
>>
>> Following the instructions in http://doc.trolltech.com/4.2/
>> qtextbrowser.html#details , I do the following:
>>
>> QTextBrowser foo(...);
>>
>> foo.setSource("qrc:/docs/index.html");
>>
>>
>> It doesn't seem to find the file - the html reverts to the default
>> for this widget. I have no trouble accessing the image referenced
>> in the qrc file using ":/images/question.png".
>>
>> Has anyone had any success with this particular invocation?
>>
>> Thanks.
>>
>> --
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
>> with "unsubscribe" in the subject or the body.
>> List archive and information: http://lists.trolltech.com/qt-interest/
>>
--
[ signature omitted ]
Message 5 in thread
On 5/17/07, Bruno Trindade <bruno@xxxxxxxxx> wrote:
> foo.setSource("qrc:/docs/index.html");
Maybe it's a typo? qrc:/docs/index.html isn't a valid url, whilst
qrc://docs/index.html is.
Have you debugged how QUrl treads qrc:/docs/index.html?
--
[ signature omitted ]