2

Im developing a static library, and I use a qrc file. I read the documentation and found, that I have to call Q_INIT_RESOURCE to make it work, but no success so far.

  • I called Q_INIT_RESOURCE in main, directly after creating the QApplication (I tried different places too, such as directly before accessing it etc.)
  • No namespace
  • The ressource file is added to the Project file of the library
  • The file itself works, if using in a normal Qt Application via resource
  • I used QDirIterator to list all resource, but no matter what I add to the file, it won't appear

I don't now whats going wrong here. If code is requested, I can post some, but except of calling Q_INIT_RESOURCE and creating a QFile with the resource, there is nothing special about it

Felix
  • 6,885
  • 1
  • 29
  • 54

1 Answers1

4

I figured it out myself. I'm actually using two libraries, and one used the same name for it's resource file. That won't work. I solved the problem by changing the name of my ressource.

Felix
  • 6,885
  • 1
  • 29
  • 54
  • If you are using libraries with some resources, just create a qrc file, where ever you want. But this one thing you must don't forget: i the pro file of your executable app implement this piece of code: RESOURCES += ../../mydb/dbaccess/resources.qrc. Of course your path to qrc, not mydb/dbaccess... These RESOURCES += line, you can repeat as often you want ;-) – peter70 Apr 09 '18 at 11:45
  • 1
    Edit: unfortunately you're absolutely right: the names of the qrc files must be different! – peter70 Apr 09 '18 at 12:03