Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Switch to click_x/click_y instead of clicked_* which is used in QgsMa…
…pToolFeatureAction
  • Loading branch information
Gustry authored and m-kuhn committed Dec 27, 2021
1 parent 58becc5 commit 69f86a4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions python/core/auto_generated/qgsactionscope.sip.in
Expand Up @@ -20,7 +20,7 @@ Examples:

<dl>
<dt>Canvas</dt>
<dd>Show for canvas tools. Adds `@clicked_x` and `@clicked_y` in map coordinates.</dd>
<dd>Show for canvas tools. Adds `@click_x` and `@click_y` in map coordinates.</dd>
<dt>Feature</dt>
<dd>Show in feature specific places like the attribute table or feature
form.</dd>
Expand Down Expand Up @@ -61,7 +61,7 @@ of the corresponding properties.
%Docstring
An expression scope may offer additional variables for an action scope.
This can be an `field_name` for the attribute which was clicked or
`clicked_x` and `clicked_y` for actions which are available as map canvas clicks.
`click_x` and `click_y` for actions which are available as map canvas clicks.

.. versionadded:: 3.0
%End
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsactionscope.h
Expand Up @@ -32,7 +32,7 @@
*
* <dl>
* <dt>Canvas</dt>
* <dd>Show for canvas tools. Adds `@clicked_x` and `@clicked_y` in map coordinates.</dd>
* <dd>Show for canvas tools. Adds `@click_x` and `@click_y` in map coordinates.</dd>
* <dt>Feature</dt>
* <dd>Show in feature specific places like the attribute table or feature
* form.</dd>
Expand Down Expand Up @@ -75,7 +75,7 @@ class CORE_EXPORT QgsActionScope
/**
* An expression scope may offer additional variables for an action scope.
* This can be an `field_name` for the attribute which was clicked or
* `clicked_x` and `clicked_y` for actions which are available as map canvas clicks.
* `click_x` and `click_y` for actions which are available as map canvas clicks.
*
* \since QGIS 3.0
*/
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsactionscoperegistry.cpp
Expand Up @@ -23,8 +23,8 @@ QgsActionScopeRegistry::QgsActionScopeRegistry( QObject *parent )
// Register some default action scopes:

QgsExpressionContextScope canvasScope;
canvasScope.addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "clicked_x" ), 25, true ) );
canvasScope.addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "clicked_y" ), 30, true ) );
canvasScope.addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "click_x" ), 25, true ) );
canvasScope.addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "click_y" ), 30, true ) );
mActionScopes.insert( QgsActionScope( QStringLiteral( "Canvas" ), tr( "Canvas" ), tr( "Available for the action map tool on the canvas." ), canvasScope ) );

QgsExpressionContextScope fieldScope;
Expand Down
2 changes: 1 addition & 1 deletion tests/src/app/testqgsmaptoolidentifyaction.cpp
Expand Up @@ -61,7 +61,7 @@ class TestQgsMapToolIdentifyAction : public QObject
void identifyMesh(); // test identification for mesh layer
void identifyVectorTile(); // test identification for vector tile layer
void identifyInvalidPolygons(); // test selecting invalid polygons
void clickxy(); // test if clicked_x and clicked_y variables are propagated
void clickxy(); // test if click_x and click_y variables are propagated
void closestPoint();

private:
Expand Down

0 comments on commit 69f86a4

Please sign in to comment.