Skip to content
Permalink
Browse files
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 69f86a4eb686196359c17edb151e9a55f6e86395
@@ -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>
@@ -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
@@ -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>
@@ -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
*/
@@ -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;
@@ -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:

0 comments on commit 69f86a4

Please sign in to comment.