qml.v1: gopkg.in/qml.v1/cmd/genqrc Files

Command genqrc

Command genqrc packs resource files into the Go binary.

Usage: genqrc [options] <subdir1> [<subdir2> ...]

The genqrc tool packs all resource files under the provided subdirectories into a single qrc.go file that may be built into the generated binary. Bundled files may then be loaded by Go or QML code under the URL "qrc:///some/path", where "some/path" matches the original path for the resource file locally.

For example, the following will load a .qml file from the resource pack, and that file may in turn reference other content (code, images, etc) in the pack:

component, err := engine.LoadFile("qrc://path/to/file.qml")

Starting with Go 1.4, this tool may be conveniently run by the "go generate" subcommand by adding a line similar to the following one to any existent .go file in the project (assuming the subdirectories ./code/ and ./images/ exist):

//go:generate genqrc code images

Then, just run "go generate" to update the qrc.go file.

During development, the generated qrc.go can repack the filesystem content at runtime to avoid the process of regenerating the qrc.go file and rebuilding the application to test every minor change made. Runtime repacking is enabled by setting the QRC_REPACK environment variable to 1:

export QRC_REPACK=1

This does not update the static content in the qrc.go file, though, so after the changes are performed, genqrc must be run again to update the content that will ship with built binaries.

Package Files


Package main imports 7 packages (graph). Updated 2016-08-31. Refresh now. Tools for package owners.