Friday, May 22, 2009


Command rbrcc is a generator from Qt resource collection file(.qrc) to ruby class. Demos and examples of Qt 4.5.1 SDK have some resource collection files. Let's try to generate ruby classes from these resource collection files with below ruby codes:
qt_dir = '/opt/qtsdk-2009.02/qt'
target_dir = '/path/to/target_dir'
`find #{qt_dir}/demos #{qt_dir}/examples -name '*.qrc'`.split.each do |resouce_file|
  basename = File.basename resouce_file, '.qrc'
  `/opt/ruby-1.9.1/bin/rbrcc #{resouce_file} -o #{target_dir}/#{basename}.rb`

Ruby classes are generated, and these contain hex of binaries listed in resource collection files.

No comments:

Post a Comment