QGIS/python/core/qgsactionscope.sip
Matthias Kuhn 5b4a88f8e0 [feature] Add layer scoped actions
Within the attribute table, there is a new button to trigger actions
which are not based on individual features but instead on the whole layer.
Normally they will perform actions based on all features or the selection.

In addition to this, a lot of cleanup has been done.
2016-11-16 09:33:19 +01:00

114 lines
3.6 KiB
Plaintext

/***************************************************************************
qgsactionscope.sip - QgsActionScope
---------------------
begin : 1.11.2016
copyright : (C) 2016 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/** \ingroup core
* An action scope defines a "place" for an action to be shown and may add
* additional expression variables.
* Each QgsAction can be available in one or several action scopes.
*
* Examples:
* ---------
*
* <dl>
* <dt>Canvas</dt>
* <dd>Show for canvas tools. Adds `@clicked_x` and `@clicked_y` in map coordinates.</dd>
* <dt>AttributeTable</dt>
* <dd>Show in attribute table for each row.</dd>
* <dt>FieldSpecific</dt>
* <dd>Show on right click in attribute table. Adds `@field_index` and `@field_name`.</dd>
* <dt>Selection</dt>
* <dd>Show in attribute table and work on the layer or selection.</dd>
* </dl>
*
* @note Added in QGIS 3.0
*/
class QgsActionScope
{
%TypeHeaderCode
#include "qgsactionscope.h"
%End
public:
/**
* Creates a new action scope.
*/
explicit QgsActionScope();
/**
* Creates a new action scope.
* For details concerning the parameters check the documentation
* of the corresponding properties.
*/
explicit QgsActionScope( const QString& id, const QString& title, const QString& description, const QgsExpressionContextScope& expressionContextScope = QgsExpressionContextScope() );
/**
* Compares two action scopes
*/
bool operator==( const QgsActionScope& other ) const;
/**
* 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.
*
* @note Added in QGIS 3.0
*/
QgsExpressionContextScope expressionContextScope() const;
/**
* \copydoc expressionContextScope()
*/
void setExpressionContextScope( const QgsExpressionContextScope& expressionContextScope );
/**
* A unique identifier for this action scope.
*
* @note Added in QGIS 3.0
*/
QString id() const;
//! \copydoc id()
void setId( const QString& id );
/**
* The title is a human readable and translated string that will be
* presented to the user in the properties dialog.
*
* @note Added in QGIS 3.0
*/
QString title() const;
//! \copydoc title()
void setTitle( const QString& title );
/**
* The description should be a longer description of where actions in this scope
* are available. It is not necessary to list the available expression variables
* in here, they are extracted automatically from the expressionContextScope().
*
* @note Added in QGIS 3.0
*/
QString description() const;
//! \copydoc description()
void setDescription( const QString& description );
/**
* Returns if this scope is valid.
*
* @note Added in QGIS 3.0
*/
bool isValid() const;
};