Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 8ff7a38
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/core/qgsexpressioncontext.cpp
Expand Up @@ -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 ) );
Expand Down

0 comments on commit 8ff7a38

Please sign in to comment.