Michał Walenciak
Michał Walenciak

Reputation: 4369

Add file from build dir to qrc file

I'm preparing translations for my application exactly like guy here. The problem I've is that .qm file is generated in build dir (which is fine) but resource compiler cannot find there whle compiling qrc file.

What I want to achieve is to have qrc file with entries refering to qm files from build dir.

Upvotes: 2

Views: 447

Answers (1)

adlag
adlag

Reputation: 1036

I can give you a procedure that works but maybe it is not what you are after.

We have a subdirectory of our resource branch called 'translations'. This subdir contains all our ts files for the languages we support. These ts files are under svn control. Our pro file contains the directives (only one language shown)

TRANSLATIONS+=  $$PWD/resources/translations/safepackager_nl.ts
!exists( $$PWD/resources/translations/safepackager_nl.ts ): warning( "not existing safepackager_nl.ts" )
!exists( $$PWD/resources/translations/safepackager_nl.qm ): warning( "run lrelease: not existing safepackager_nl.qm" ) 

Every time strings in our source change we use Qt Linguist to translate the newly added or edited strings. Next we run lupdate from within Qt Creator and then run lrelease from within Qt Creator. lupdate generates/updates the ts files and lrelease generates/updates the qm files. The qm files - located at the same location as the ts files - are not under svn control. The builder finds the qm files during build.

The lesson being - I guess - is that when ts files and qm files are in the same directory building will succeed without the need of setting additional paths.

Upvotes: 1

Related Questions