Getting values from pro files in Qt
values from pro files in Qt:
DEFINES += VERSION=\\\"$$VERSION\\\"
The macro use the C source code to get the backslashes and quotes number not a string.
The simole statement is:
YourApp.pro:
VERSION = 0.0.0.1 DEFINES += APP_VERSION=\\\"$$VERSION\\\"
The main.cpp:
#include <QApplication> QCoreApplication::setApplicationVersion(QString(APP_VERSION));
Source code is controller.cpp:
#include <QApplication> QString yourAppVersion = QCoreApplication::applicationVersion();