Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt qrc/rcc files #461

Open
Larpon opened this issue Oct 16, 2022 · 3 comments
Open

Qt qrc/rcc files #461

Larpon opened this issue Oct 16, 2022 · 3 comments
Labels
format:archive format request Format support request by 3rd party.

Comments

@Larpon
Copy link

Larpon commented Oct 16, 2022

The format is a little hard to find any official specs for but it looks like it can be done.

Example project:
https://github.com/pgaskin/qrc

@qkaiser
Copy link
Contributor

qkaiser commented Oct 18, 2022

Some more info available at https://doc.qt.io/qt-6/rcc.html

The rcc tool is used to embed resources into a Qt application during the build process. It works by generating a C++ source file containing data specified in a Qt resource (.qrc) file.

@Larpon do you have any sample files we could look at ?

@qkaiser qkaiser added format:archive format request Format support request by 3rd party. labels Oct 18, 2022
@Larpon
Copy link
Author

Larpon commented Oct 18, 2022

I'll try and cook one up for you - here's also some of the original C++ source for handling the rcc

@Larpon
Copy link
Author

Larpon commented Oct 18, 2022

GitHub doesn't support uploading .rcc files directly - so here's a .zip with 2 common types of .rcc files included:
rcc.zip.

The .zip also contains the files for generating the .rcc files, namely the original .qrc file and the actual contents of the .rcc output - I thought these could be helpful to have.

Assuming you have the rcc tool installed (I used the rcc tool shipped with Qt 5.14.2) and the provided rcc.zip unpacked into /tmp/rcc, the target files are:

  • resources.rcc - an uncompressed .rcc, generated with: rcc -binary -no-compress -o /tmp/rcc/resources.rcc /tmp/rcc/resources.qrc
  • resources_compressed.rcc - a compressed .rcc, generated with: rcc -binary --compress 9 --compress-algo zlib -o /tmp/rcc/resources_compressed.rcc /tmp/rcc/resources.qrc

Just for the record: it's the included *.rcc files this request is about - not any of the other files 🙂

Additional info
The rcc tool I used only supported zlib as a compression option.
The rcc tool can generate .rcc files in different format versions - I do not know what the default version is - but I think it defaults to version 3 of the format - I can provide .rcc files in different formats if needed.

The output of running rcc -h on the command line:

rcc -h
Usage: rcc [options] inputs
Qt Resource Compiler version 5.14.2

Options:
  -h, --help                            Displays help on commandline options.
  --help-all                            Displays help including Qt specific
                                        options.
  -v, --version                         Displays version information.
  -o, --output <file>                   Write output to <file> rather than
                                        stdout.
  -t, --temp <file>                     Use temporary <file> for big resources.
  --name <name>                         Create an external initialization
                                        function with <name>.
  --root <path>                         Prefix resource access path with root
                                        path.
  --compress-algo <algo>                Compress input files using algorithm
                                        <algo> ([zlib], none).
  --compress <level>                    Compress input files by <level>.
  --no-compress                         Disable all compression. Same as
                                        --compress-algo=none.
  --threshold <level>                   Threshold to consider compressing
                                        files.
  --binary                              Output a binary file for use as a
                                        dynamic resource.
  -g, --generator <cpp|python|python2>  Select generator.
  --pass <number>                       Pass number for big resources
  --namespace                           Turn off namespace macros.
  --verbose                             Enable verbose mode.
  --list                                Only list .qrc file entries, do not
                                        generate code.
  --list-mapping                        Only output a mapping of resource paths
                                        to file system paths defined in the .qrc
                                        file, do not generate code.
  -d, --depfile <file>                  Write a depfile with the .qrc
                                        dependencies to <file>.
  --project                             Output a resource file containing all
                                        files from the current directory.
  --format-version <number>             The RCC format version to write

Arguments:
  inputs                                Input files (*.qrc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
format:archive format request Format support request by 3rd party.
Projects
None yet
Development

No branches or pull requests

2 participants