Let's say you export the variables in the project file as macros (in this case you set the target name for the application), then using it from C++ is just simple.
In the project file (.pro)
TARGET = YourApp TEMPLATE = app DEFINES += TARGET=\\\"$TARGET\\\"
then you can use it in your C++ code like this:
// translation files are stored in resource file as YourApp_locale.qm
if translator.load(QString(TARGET) + "_" + locale, ":/languages") {
...
...
}
Thanks! Your QString Argument before TARGET got me on the right track :-)
ReplyDelete