Skip to content
Permalink
Browse files

add 'qgis_short_version' expression variable to retrieve QGIS version

in the major.minor notation (can be useful for help system and probably
in other places)
  • Loading branch information
alexbruy committed Jan 10, 2017
1 parent a074343 commit 8ff7a3880ffbc632d0847b76f729b0d043d740b7
Showing with 1 addition and 0 deletions.
  1. +1 −0 src/core/qgsexpressioncontext.cpp
@@ -521,6 +521,7 @@ QgsExpressionContextScope* QgsExpressionContextUtils::globalScope()
//add some extra global variables
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "qgis_version" ), Qgis::QGIS_VERSION, true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "qgis_version_no" ), Qgis::QGIS_VERSION_INT, true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "qgis_short_version" ), QStringLiteral( "%1.%2" ).arg( Qgis::QGIS_VERSION_INT / 10000 ).arg( Qgis::QGIS_VERSION_INT / 100 % 100 ), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "qgis_release_name" ), Qgis::QGIS_RELEASE_NAME, true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "qgis_platform" ), QgsApplication::platform(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "qgis_os_name" ), QgsApplication::osName(), true ) );

0 comments on commit 8ff7a38

Please sign in to comment.
You can’t perform that action at this time.