Skip to content
Permalink
Browse files

Fix bindings and docs

  • Loading branch information
m-kuhn committed Nov 16, 2016
1 parent e7d8b2c commit 08d350c0cbbbc16ae2d064c3dbc1c416f905d764
@@ -41,6 +41,20 @@ class QgsAction
//! The short title is used to label user interface elements like buttons
QString shortTitle() const;

/**
* Returns a unique id for this action.
*
* @note Added in QGIS 3.0
*/
QString id() const { return mShortTitle; }

/**
* Returns true if this action was a default constructed one.
*
* @note Added in QGIS 3.0
*/
bool isValid() const { return !mShortTitle.isNull(); }

//! The path to the icon
QString iconPath() const;

@@ -59,6 +73,20 @@ class QgsAction
//! Checks if the action is runable on the current platform
bool runable() const;

/**
* Run this action.
*
* @note Added in QGIS 3.0
*/
void run( QgsVectorLayer* layer, const QgsFeature& feature, const QgsExpressionContext& expressionContext ) const;

/**
* Run this action.
*
* @note Added in QGIS 3.0
*/
void run( const QgsExpressionContext& expressionContext ) const;

/**
* The action scopes define where an action will be available.
* Action scopes may offer additional variables like the clicked
@@ -69,7 +69,7 @@ class QgsActionManager

/** Does the action using the expression engine to replace any embedded expressions
* in the action definition.
* @param index action index
* @param actionId action id
* @param feature feature to run action for
* @param context expression context to evalute expressions under
*/
@@ -25,11 +25,12 @@
* <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>
* <dt>Feature</dt>
* <dd>Show in feature specific places like the attribute table or feature
* form.</dd>
* <dt>Field</dt>
* <dd>Show in context menus for individual fields (e.g. attribute table). Adds `@field_index`, `@field_name` and `@field_value`.</dd>
* <dt>Layer</dt>
* <dd>Show in attribute table and work on the layer or selection.</dd>
* </dl>
*
@@ -43,7 +44,9 @@ class QgsActionScope
%End
public:
/**
* Creates a new action scope.
* Creates a new invalid action scope.
*
* @note Added in QGSI 3.0
*/
explicit QgsActionScope();

@@ -35,10 +35,20 @@ class QgsActionScopeRegistry : QObject
%End

public:
/**
* Create a new QgsActionScopeRegistry.
* QGIS already creates a central registry. You will normally
* want to use QgsApplication::actionScopeRegistry() to get acess
* to that one instead.
*
* @note Added in QGIS 3.0
*/
explicit QgsActionScopeRegistry( QObject* parent = nullptr );

/**
* Get all registered action scopes.
*
* @note Added in QGIS 3.0
*/
QSet<QgsActionScope> actionScopes() const;

@@ -378,6 +378,12 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
//dummy method to workaround sip generation issue issue
bool x11EventFilter ( XEvent * event );
%End
/**
* Returns the action scope registry.
*
* @Note Added in QGIS 3.0
*/
static QgsActionScopeRegistry* actionScopeRegistry();

public slots:

@@ -229,7 +229,7 @@ class QgsAttributeTableAction : QAction
%End

public:
QgsAttributeTableAction( const QString &name, QgsDualView *dualView, int action, const QModelIndex &fieldIdx );
QgsAttributeTableAction( const QString &name, QgsDualView *dualView, const QString& action, const QModelIndex &fieldIdx );

public slots:
void execute();
@@ -35,6 +35,7 @@ class QgsActionMenu : QMenu
* @param feature The feature that this action will be run upon. Make sure that this feature is available
* for the lifetime of this object.
* @param parent The usual QWidget parent.
* @param actionScope The action scope this menu will run in
*/
explicit QgsActionMenu( QgsVectorLayer* layer, const QgsFeature& feature, const QString& actionScope, QWidget *parent /TransferThis/ = nullptr );

@@ -44,6 +45,7 @@ class QgsActionMenu : QMenu
* @param layer The layer that this action will be run upon.
* @param fid The feature id of the feature for which this action will be run.
* @param parent The usual QWidget parent.
* @param actionScope The action scope this menu will run in
*/
explicit QgsActionMenu( QgsVectorLayer *layer, const QgsFeatureId fid, const QString& actionScope, QWidget *parent /TransferThis/ = nullptr );

@@ -90,8 +90,18 @@ class CORE_EXPORT QgsAction
//! The short title is used to label user interface elements like buttons
QString shortTitle() const { return mShortTitle; }

/**
* Returns a unique id for this action.
*
* @note Added in QGIS 3.0
*/
QString id() const { return mShortTitle; }

/**
* Returns true if this action was a default constructed one.
*
* @note Added in QGIS 3.0
*/
bool isValid() const { return !mShortTitle.isNull(); }

//! The path to the icon
@@ -119,12 +129,16 @@ class CORE_EXPORT QgsAction
bool runable() const;

/**
* Run this expression.
* Run this action.
*
* @note Added in QGIS 3.0
*/
void run( QgsVectorLayer* layer, const QgsFeature& feature, const QgsExpressionContext& expressionContext ) const;

/**
* Run this expression.
* Run this action.
*
* @note Added in QGIS 3.0
*/
void run( const QgsExpressionContext& expressionContext ) const;

@@ -84,7 +84,7 @@ class CORE_EXPORT QgsActionManager

/** Does the action using the expression engine to replace any embedded expressions
* in the action definition.
* @param index action index
* @param actionId action id
* @param feature feature to run action for
* @param context expression context to evalute expressions under
*/
@@ -30,15 +30,16 @@
* <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>
* <dt>Feature</dt>
* <dd>Show in feature specific places like the attribute table or feature
* form.</dd>
* <dt>Field</dt>
* <dd>Show in context menus for individual fields (e.g. attribute table). Adds `@field_index`, `@field_name` and `@field_value`.</dd>
* <dt>Selection</dt>
* <dt>Layer</dt>
* <dd>Show in attribute table and work on the layer or selection.</dd>
* </dl>
*
* \since QGIS 3.0
* @note Added in QGIS 3.0
*/

class CORE_EXPORT QgsActionScope
@@ -47,6 +48,8 @@ class CORE_EXPORT QgsActionScope

/**
* Creates a new invalid action scope.
*
* @note Added in QGSI 3.0
*/
explicit QgsActionScope();

@@ -37,21 +37,24 @@
class CORE_EXPORT QgsActionScopeRegistry : public QObject
{
Q_OBJECT
/**
* The action scopes which are currently registered and available.
*
* \read actionScopes()
* \notify actionScopesChanged()
*
* \since QGIS 3.0
*/
Q_PROPERTY( QSet<QgsActionScope> actionScopes READ actionScopes NOTIFY actionScopesChanged )

public:

/**
* Create a new QgsActionScopeRegistry.
* QGIS already creates a central registry. You will normally
* want to use QgsApplication::actionScopeRegistry() to get acess
* to that one instead.
*
* @note Added in QGIS 3.0
*/
explicit QgsActionScopeRegistry( QObject* parent = nullptr );

/**
* Get all registered action scopes.
*
* @note Added in QGIS 3.0
*/
QSet<QgsActionScope> actionScopes() const;

@@ -69,9 +72,21 @@ class CORE_EXPORT QgsActionScopeRegistry : public QObject
*/
void unregisterActionScope( const QgsActionScope& actionScope );

/**
* Get an action scope by its id.
*
* @note Added in QGIS 3.0
*/
QgsActionScope actionScope( const QString& id );

signals:

/**
* Emitted whenever a new action scope is registered or an action scope
* is unregistered.
*
* @note Added in QGIS 3.0
*/
void actionScopesChanged();

private:
@@ -376,6 +376,8 @@ class CORE_EXPORT QgsApplication : public QApplication

/**
* Returns the action scope registry.
*
* @Note Added in QGIS 3.0
*/
static QgsActionScopeRegistry* actionScopeRegistry();

@@ -62,6 +62,7 @@ class GUI_EXPORT QgsActionMenu : public QMenu
* @param feature The feature that this action will be run upon. Make sure that this feature is available
* for the lifetime of this object.
* @param parent The usual QWidget parent.
* @param actionScope The action scope this menu will run in
*/
explicit QgsActionMenu( QgsVectorLayer* layer, const QgsFeature& feature, const QString& actionScope, QWidget *parent = nullptr );

@@ -71,6 +72,7 @@ class GUI_EXPORT QgsActionMenu : public QMenu
* @param layer The layer that this action will be run upon.
* @param fid The feature id of the feature for which this action will be run.
* @param parent The usual QWidget parent.
* @param actionScope The action scope this menu will run in
*/
explicit QgsActionMenu( QgsVectorLayer *layer, const QgsFeatureId fid, const QString& actionScope, QWidget *parent = nullptr );

@@ -87,13 +89,13 @@ class GUI_EXPORT QgsActionMenu : public QMenu
*/
void setFeature( const QgsFeature& feature );

signals:
void reinit();

private slots:
void triggerAction();
void reloadActions();

signals:
void reinit();

private:
void init();
QgsFeature feature();

0 comments on commit 08d350c

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