How to initialize Qt resources from a shared library? -
i can not figure out how initialize qt resources declared in , used shared library under red hat enterprise linux 5.2.
i added qt resource file shared library, added prefix named "resource", , added file "files/stylesheet.xsl". resource file named "resources.qrc". qfile::exists returns false?
mysharedlib::mysharedlib() { // think q_init_resource expands this: // resource file named "resources.qrc" extern int qinitresources_resources(); qinitresources_resources(); qstring resourcepath = ":/resource/files/stylesheet.xsl"; if( false == qfile::exists(resourcepath)) { printf("*** error - resource path not found : \"%s\"\n", resourcepath.tolatin1().data()); } }
thanks in advance tips or suggestions,
the problem under linux, can not have identically named qt resource files (*.qrc) in both shared library , application. not problem under windows under linux load 1 of identically named resource files. had named resource files in both application , shared library files "resources.qrc". renamed "resourcesmylib.qrc" , "resourcesmyapp.qrc" , good. did not need add call q_init_resources library or call qinitresources_resources*.
solution
- use unique qt resource file names library , application under linux.
credit goes jaco n. on qt-interest mailing list. thank jaco!
Comments
Post a Comment