[Qt-interest] What's the difference between a .pro and a .pri file?
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Wed Jan 14 15:12:35 CET 2009
Malte Witt wrote on Wednesday, January 14, 2009 11:38 AM:
> > ...
> This way you can out-source global settings and include them in
> different subprojects :-)
We found the solution to the following scenario to be very useful:
You have an application consisting of several DLLs (shared objects) and an executable (which basically just consists of a main() function + some initialisation). There are text strings distributed all over the DLL projects and you want to translate (i18n) them. But you don't feel like lupdate-ing each *.pro file and load each resulting translation file into Designer separately.
So the solution to this is: "outsource the sources" ;)
So you have e.g.:
TheApplication
+- Utils
- Utils.pro
- Sources.pri
+- Core
- Core.pro
- Sources.pri
+- Etc.
- Etc.pro
- Sources.pri
+- TheApplication
- TheApplication.pro
- Sources.pri
TheApplication.pro
Translation.pro
CommonSettings.pri
The top-level 'TheApplication.pro' would simply build all the DLLs and executable, as before. Each sub-project, e.g. Utils.pro, includes its Sources.pri, which on their turn contain simply the respective source files:
SOURCES += ...
HEADERS += ...
FORMS += ...
Now the trick: Translation.pro does nothing more than include all sources:
include (Utils/Sources.pri)
include (Core/Sources.pri)
include (Etc./Sources.pri)
include (TheApplication/Sources.pri)
Now you only need to call lupdate on one single Translation.pro and have a single file to be translated!
In the same way you can specify common settings (DEFINES etc.) for all projects (CommonSettings.pri) and include this file into each project *.pro file etc.
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list