I have defined this macro in my *.pro project file:
# The application version
VERSION = 6.10.0
# Define the preprocessor macro to get the application version in our application.
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
Then I set my application version like this:
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
/*
* Setting the Application version
*/
app.setApplicationVersion(APP_VERSION);
// ...
}
Now I want to access the application version inside my QML code which is in a shared library. How can I do that? :
ColumnLayout {
id: versionLayout
StyledLabel {
text: qsTr("Version")
font.weight: Font.Bold
}
RowLayout {
StyledLabel {
Layout.alignment: Qt.AlignCenter
text: APP_VERSION // How can I access my macro/version here?
// QApplication.applicationVersion() is NOT working!
}
}
}