Qt-interest Archive, October 2007
QResource and QFile with vc++
Message 1 in thread
I use resource embedding in my project:
<qresource>
<file>/mainmenu.htm</file>
</qresource>
The following code works ok on Mac:
QFile f (":/mainmenu.htm");
if (!f.open (QIODevice::ReadOnly | QIODevice::Text))
{
qDebug () << "fail to open file";
return;
}
on Windows with vc++ 2003 open () fails.
What might be wrong?
Thanks in advance ,
Serguei
--
[ signature omitted ]
Message 2 in thread
Try removing the slash (make it relative instead of absolute):
<qresource>
<file>mainmenu.htm</file>
</qresource>
Keith
**Please do not reply to me, reply to the list.**
On 10-16-2007 3:16 PM, "vdoser" wrote:
> I use resource embedding in my project:
> <qresource>
> <file>/mainmenu.htm</file>
> </qresource>
>
> The following code works ok on Mac:
>
> QFile f (":/mainmenu.htm");
> if (!f.open (QIODevice::ReadOnly | QIODevice::Text))
> {
> qDebug () << "fail to open file";
> return;
> }
>
> on Windows with vc++ 2003 open () fails.
>
> What might be wrong?
>
> Thanks in advance ,
> Serguei
>
--
[ signature omitted ]
Message 3 in thread
still does not work :(.
any more ideas?
Thanks,
Serguei
In article <C33A8BA9.C31D%keith.esau@xxxxxxx>, keith.esau@xxxxxxx says...
>
>Try removing the slash (make it relative instead of absolute):
> <qresource>
> <file>mainmenu.htm</file>
> </qresource>
>
>
>Keith
>**Please do not reply to me, reply to the list.**
>
>
>On 10-16-2007 3:16 PM, "vdoser" wrote:
>
>> I use resource embedding in my project:
>> <qresource>
>> <file>/mainmenu.htm</file>
>> </qresource>
>>
>> The following code works ok on Mac:
>>
>> QFile f (":/mainmenu.htm");
>> if (!f.open (QIODevice::ReadOnly | QIODevice::Text))
>> {
>> qDebug () << "fail to open file";
>> return;
>> }
>>
>> on Windows with vc++ 2003 open () fails.
>>
>> What might be wrong?
>>
>> Thanks in advance ,
>> Serguei
>>
>
>
>--
>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
I use the "alias" attribute, to describe what should appear after the
: in the resource virtual filesystem. The text child element of the
<file> should contain the relative path (relative to the location of
the .qrc file).
<file alias="/mainmenu.htm">mainmenu.htm</file>
Then you should be able to access the file via
QFile f (":/mainmenu.htm");
If you leave out the / in the alias, you can also leave out the /
after the : in the QFile ctor arg.
On 10/17/07, vdoser <sergueiv@xxxxxxxxxxxxx> wrote:
> still does not work :(.
>
> any more ideas?
>
> Thanks,
> Serguei
>
> In article <C33A8BA9.C31D%keith.esau@xxxxxxx>, keith.esau@xxxxxxx says...
> >
> >Try removing the slash (make it relative instead of absolute):
> > <qresource>
> > <file>mainmenu.htm</file>
> > </qresource>
> >
> >
> >Keith
> >**Please do not reply to me, reply to the list.**
> >
> >
> >On 10-16-2007 3:16 PM, "vdoser" wrote:
> >
> >> I use resource embedding in my project:
> >> <qresource>
> >> <file>/mainmenu.htm</file>
> >> </qresource>
> >>
> >> The following code works ok on Mac:
> >>
> >> QFile f (":/mainmenu.htm");
> >> if (!f.open (QIODevice::ReadOnly | QIODevice::Text))
> >> {
> >> qDebug () << "fail to open file";
> >> return;
> >> }
> >>
> >> on Windows with vc++ 2003 open () fails.
> >>
> >> What might be wrong?
> >>
> >> Thanks in advance ,
> >> Serguei
> >>
> >
> >
> >--
> >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/
>
> --
> 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
I fixed it. The problem was in vcproj file in a line that call rcc. Somehow it
started with "echo" command. As a result the qrc_*.cpp was not generated. I
should have noticed that at first!- still a newbie to qt...
Thanks everyone,
Serguei
In article <f377591c0710171620p321e20d1w94a73b48a2191df5@xxxxxxxxxxxxxx>,
alan.ezust@xxxxxxxxx says...
>
>I use the "alias" attribute, to describe what should appear after the
>: in the resource virtual filesystem. The text child element of the
><file> should contain the relative path (relative to the location of
>the .qrc file).
>
><file alias="/mainmenu.htm">mainmenu.htm</file>
>
>Then you should be able to access the file via
>QFile f (":/mainmenu.htm");
>
>If you leave out the / in the alias, you can also leave out the /
>after the : in the QFile ctor arg.
>
>
>
>
>On 10/17/07, vdoser <sergueiv@xxxxxxxxxxxxx> wrote:
>> still does not work :(.
>>
>> any more ideas?
>>
>> Thanks,
>> Serguei
>>
>> In article <C33A8BA9.C31D%keith.esau@xxxxxxx>, keith.esau@xxxxxxx says...
>> >
>> >Try removing the slash (make it relative instead of absolute):
>> > <qresource>
>> > <file>mainmenu.htm</file>
>> > </qresource>
>> >
>> >
>> >Keith
>> >**Please do not reply to me, reply to the list.**
>> >
>> >
>> >On 10-16-2007 3:16 PM, "vdoser" wrote:
>> >
>> >> I use resource embedding in my project:
>> >> <qresource>
>> >> <file>/mainmenu.htm</file>
>> >> </qresource>
>> >>
>> >> The following code works ok on Mac:
>> >>
>> >> QFile f (":/mainmenu.htm");
>> >> if (!f.open (QIODevice::ReadOnly | QIODevice::Text))
>> >> {
>> >> qDebug () << "fail to open file";
>> >> return;
>> >> }
>> >>
>> >> on Windows with vc++ 2003 open () fails.
>> >>
>> >> What might be wrong?
>> >>
>> >> Thanks in advance ,
>> >> Serguei
>> >>
>> >
>> >
>> >--
>> >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/
>>
>> --
>> 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/
>>
>>
>
>--
>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 ]