I posted this on the Qt forum, but it was suggested that I bring it to the 
mailing list instead.  The original post is at 
http://qt-project.org/forums/viewthread/46927

I read the documentation on the Resource Compiler (rcc), and my interest is in 
building existing projects using standard platform tools without qmake. That 
is, I’m adding logic to run rcc over a *.qrc file to produce a cpp file.

First, I read about the -compress / -no-compress options. That is all or 
nothing for the entire translation unit. Is there an attribute in the XML (qrc) 
file to control this on a case-by-case basis? In particular, it’s 
counterproductive to try and compress a png file, but other kinds of resources 
might very well benefit from compression, and differing level for each.

I could not find any additional documentation on the qrc xml file format, and 
only see the alias attribute. Are there others, such as compression?

(Aside: what about different compression libraries? 7zip’s lzma appears to 
produce much smaller files than classic deflate.)

The second issue concerns the -name option to rcc. Using a build tool as 
mentioned above, every *.qrc file needs to have its -name associated somehow. 
That would mean manually listing every such file individually and repeating the 
command with different parameters. That is in contrast to a rule that says 
“every *.qrc file produces a *.cpp file with a name derived from the input 
file”. It is not great to determine the -name from the input file too, as every 
subproject will want to have a file named simply resources.qrc and not some 
globally unique name.

It would make sense to put the -name in the qrc file itself, rather than 
supplied separately to the rcc tool. This could simply be another attribute to 
the qresource element that serves the same function as the existing -name 
option. More extensible would be a new element that could contain more details 
for the generated code.

Let me make sure I understand what that’s used for: The named function needs to 
be called at some point to make the resources available, but is otherwise not 
used, right? Different *.qrc files prepared by different developers in 
different parts of the code base (in the same resulting executable file) are 
distinguished by the ‘prefix’, right?

If that’s right, couldn’t the generated code contain a dummy object using the 
“static constructor” technique to cause the registration function to be called 
sometime before main(), and not need an exposed name at all?
(Update:  it looks like a macro is generating a static object with a ctor, but 
it is still necessary to explicitly call the init function for it to work.  So 
I don't see what's going on there exactly.)

—John
_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to