[Qt-interest] Linux shared library can not load Qt resources?Resource initialization problem ?
Ed Sutton
ESutton at fescorp.com
Wed Dec 1 00:03:25 CET 2010
On Nov 30, 2010, at 4:19 PM, Scott Aron Bloom wrote:
> Please don't respond to my email.. Reply to the list...
>
> Yes, however, I usually call it for all my DLLs that contain resources
> from the main.cpp or after they are loaded via a QLibrary::load
Curious. Still no success.
I bypassed the Q_INIT_RESOURCES macro and added this to the constructor of the shared library class that access the resource.
SharedLibClass:: SharedLibClass()
{
// I think Q_INIT_RESOURCE basically exapnds to this:
// resource file is named resources.qrc.
extern int qInitResources_resources();
qInitResources_resources();
}
>
> Scott
>
> -----Original Message-----
> From: Ed Sutton [mailto:ESutton at fescorp.com]
> Sent: Tuesday, November 30, 2010 2:17 PM
> To: Scott Aron Bloom
> Subject: Re: [Qt-interest] Linux shared library can not load Qt
> resources?Resource initialization problem ?
>
>
>> Are you calling Q_INIT_RESOURCES ??
>
> My resource file is named resources.qrc. I added
> Q_INIT_RESOURCE(resources) to a class constructor in the shared library
> that the client creates an instance of. The resource is used internally
> by the library and not accessed directly. Calling it there did not
> help. Is this what you meant?
>
> Than you for your help,
>
> -Ed
>
>
>
>
>
>>
>> Scott
>>
>> -----Original Message-----
>> From: qt-interest-bounces at trolltech.com
>> [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Ed Sutton
>> Sent: Tuesday, November 30, 2010 2:06 PM
>> To: Qt-interest Interest
>> Subject: [Qt-interest] Linux shared library can not load Qt resources?
>> Resource initialization problem ?
>>
>> I added a Qt resource file to my shared library project. I added a
>> "/resource" prefix then added an XSL file to the resource. I can not
>> figure out how to load the resource. I found some postings about
>> problems with Qt resources in libraries but did not understand or find
> a
>> solution that worked. Has anyone seen this?
>>
>> QString resourcePath = ":/resource/files/eot.xsl";
>> if( false == QFile::exists(resourcePath)
>> {
>> printf("*** Error - Resource path not found : \"%s\"\n",
>> resourcePath.toLatin1().data());
>> }
>> else
>> {
>> QFile::copy(resourcePath, styleSheetPathFileName))
>> }
>>
>>
>> // File: resources.qrc
>>
>> <RCC>
>> <qresource prefix="/resource">
>> <file>files/eot.xsl</file>
>> </qresource>
>> </RCC>
>>
>> Thanks in advance,
>>
>> -Ed
>>
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
> -Ed
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
-Ed
More information about the Qt-interest-old
mailing list