Documentation/Nightly/Developers/Build system/Qt resource files

From Slicer Wiki
Revision as of 18:30, 9 June 2014 by Matthew.woehlke (talk | contribs) (remove potentially confusing notice)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home < Documentation < Nightly < Developers < Build system < Qt resource files


For the latest Slicer documentation, visit the read-the-docs.


Generating QRC Files: genqrc.py

Slicer includes a tool to generate .qrc files from resource directories. This convenience tool was created to simplify working with icons, which can require several entries per icon (one per available resolution) that may be cumbersome to write by hand.

The script (genpy.py) can be found in the Utilities/Scripts directory of the Slicer source.

The positional argument(s) to the script give a list of directories that should be scanned for resource files (e.g. 'Icons'). An optional -o parameter may be used to specify the output file (otherwise the script will print to stdout). The script should normally be run in the directory of the desired output .qrc file in order to provide and generate relative paths that will be both understood correctly by the Qt resource compiler, and meaningful to other developers' checkouts.

For example, to generate qSlicerBaseQTGUI.qrc, one would run:

cd /path/to/slicer/source
cd Base/QTGUI/Resources
../../../Utilities/Scripts/genqrc.py -o qSlicerBaseQTGUI.qrc Icons

This tool is currently meant to be used in an "offline" manner (i.e. not part of the build process). When adding icons, you should re-run the script to generate an updated .qrc file and commit the updated file.