Skip to content

Commit 08d350c

Browse files
committedNov 16, 2016
Fix bindings and docs
1 parent e7d8b2c commit 08d350c

13 files changed

+112
-27
lines changed
 

‎python/core/qgsaction.sip

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,20 @@ class QgsAction
4141
//! The short title is used to label user interface elements like buttons
4242
QString shortTitle() const;
4343

44+
/**
45+
* Returns a unique id for this action.
46+
*
47+
* @note Added in QGIS 3.0
48+
*/
49+
QString id() const { return mShortTitle; }
50+
51+
/**
52+
* Returns true if this action was a default constructed one.
53+
*
54+
* @note Added in QGIS 3.0
55+
*/
56+
bool isValid() const { return !mShortTitle.isNull(); }
57+
4458
//! The path to the icon
4559
QString iconPath() const;
4660

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

76+
/**
77+
* Run this action.
78+
*
79+
* @note Added in QGIS 3.0
80+
*/
81+
void run( QgsVectorLayer* layer, const QgsFeature& feature, const QgsExpressionContext& expressionContext ) const;
82+
83+
/**
84+
* Run this action.
85+
*
86+
* @note Added in QGIS 3.0
87+
*/
88+
void run( const QgsExpressionContext& expressionContext ) const;
89+
6290
/**
6391
* The action scopes define where an action will be available.
6492
* Action scopes may offer additional variables like the clicked

‎python/core/qgsactionmanager.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class QgsActionManager
6969

7070
/** Does the action using the expression engine to replace any embedded expressions
7171
* in the action definition.
72-
* @param index action index
72+
* @param actionId action id
7373
* @param feature feature to run action for
7474
* @param context expression context to evalute expressions under
7575
*/

‎python/core/qgsactionscope.sip

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@
2525
* <dl>
2626
* <dt>Canvas</dt>
2727
* <dd>Show for canvas tools. Adds `@clicked_x` and `@clicked_y` in map coordinates.</dd>
28-
* <dt>AttributeTable</dt>
29-
* <dd>Show in attribute table for each row.</dd>
30-
* <dt>FieldSpecific</dt>
31-
* <dd>Show on right click in attribute table. Adds `@field_index` and `@field_name`.</dd>
32-
* <dt>Selection</dt>
28+
* <dt>Feature</dt>
29+
* <dd>Show in feature specific places like the attribute table or feature
30+
* form.</dd>
31+
* <dt>Field</dt>
32+
* <dd>Show in context menus for individual fields (e.g. attribute table). Adds `@field_index`, `@field_name` and `@field_value`.</dd>
33+
* <dt>Layer</dt>
3334
* <dd>Show in attribute table and work on the layer or selection.</dd>
3435
* </dl>
3536
*
@@ -43,7 +44,9 @@ class QgsActionScope
4344
%End
4445
public:
4546
/**
46-
* Creates a new action scope.
47+
* Creates a new invalid action scope.
48+
*
49+
* @note Added in QGSI 3.0
4750
*/
4851
explicit QgsActionScope();
4952

‎python/core/qgsactionscoperegistry.sip

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,20 @@ class QgsActionScopeRegistry : QObject
3535
%End
3636

3737
public:
38+
/**
39+
* Create a new QgsActionScopeRegistry.
40+
* QGIS already creates a central registry. You will normally
41+
* want to use QgsApplication::actionScopeRegistry() to get acess
42+
* to that one instead.
43+
*
44+
* @note Added in QGIS 3.0
45+
*/
3846
explicit QgsActionScopeRegistry( QObject* parent = nullptr );
3947

4048
/**
4149
* Get all registered action scopes.
50+
*
51+
* @note Added in QGIS 3.0
4252
*/
4353
QSet<QgsActionScope> actionScopes() const;
4454

‎python/core/qgsapplication.sip

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,12 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
378378
//dummy method to workaround sip generation issue issue
379379
bool x11EventFilter ( XEvent * event );
380380
%End
381+
/**
382+
* Returns the action scope registry.
383+
*
384+
* @Note Added in QGIS 3.0
385+
*/
386+
static QgsActionScopeRegistry* actionScopeRegistry();
381387

382388
public slots:
383389

‎python/gui/attributetable/qgsdualview.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class QgsAttributeTableAction : QAction
229229
%End
230230

231231
public:
232-
QgsAttributeTableAction( const QString &name, QgsDualView *dualView, int action, const QModelIndex &fieldIdx );
232+
QgsAttributeTableAction( const QString &name, QgsDualView *dualView, const QString& action, const QModelIndex &fieldIdx );
233233

234234
public slots:
235235
void execute();

‎python/gui/qgsactionmenu.sip

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class QgsActionMenu : QMenu
3535
* @param feature The feature that this action will be run upon. Make sure that this feature is available
3636
* for the lifetime of this object.
3737
* @param parent The usual QWidget parent.
38+
* @param actionScope The action scope this menu will run in
3839
*/
3940
explicit QgsActionMenu( QgsVectorLayer* layer, const QgsFeature& feature, const QString& actionScope, QWidget *parent /TransferThis/ = nullptr );
4041

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

‎src/core/qgsaction.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,18 @@ class CORE_EXPORT QgsAction
9090
//! The short title is used to label user interface elements like buttons
9191
QString shortTitle() const { return mShortTitle; }
9292

93+
/**
94+
* Returns a unique id for this action.
95+
*
96+
* @note Added in QGIS 3.0
97+
*/
9398
QString id() const { return mShortTitle; }
9499

100+
/**
101+
* Returns true if this action was a default constructed one.
102+
*
103+
* @note Added in QGIS 3.0
104+
*/
95105
bool isValid() const { return !mShortTitle.isNull(); }
96106

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

121131
/**
122-
* Run this expression.
132+
* Run this action.
133+
*
134+
* @note Added in QGIS 3.0
123135
*/
124136
void run( QgsVectorLayer* layer, const QgsFeature& feature, const QgsExpressionContext& expressionContext ) const;
125137

126138
/**
127-
* Run this expression.
139+
* Run this action.
140+
*
141+
* @note Added in QGIS 3.0
128142
*/
129143
void run( const QgsExpressionContext& expressionContext ) const;
130144

‎src/core/qgsactionmanager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class CORE_EXPORT QgsActionManager
8484

8585
/** Does the action using the expression engine to replace any embedded expressions
8686
* in the action definition.
87-
* @param index action index
87+
* @param actionId action id
8888
* @param feature feature to run action for
8989
* @param context expression context to evalute expressions under
9090
*/

‎src/core/qgsactionscope.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@
3030
* <dl>
3131
* <dt>Canvas</dt>
3232
* <dd>Show for canvas tools. Adds `@clicked_x` and `@clicked_y` in map coordinates.</dd>
33-
* <dt>AttributeTable</dt>
34-
* <dd>Show in attribute table for each row.</dd>
35-
* <dt>FieldSpecific</dt>
33+
* <dt>Feature</dt>
34+
* <dd>Show in feature specific places like the attribute table or feature
35+
* form.</dd>
36+
* <dt>Field</dt>
3637
* <dd>Show in context menus for individual fields (e.g. attribute table). Adds `@field_index`, `@field_name` and `@field_value`.</dd>
37-
* <dt>Selection</dt>
38+
* <dt>Layer</dt>
3839
* <dd>Show in attribute table and work on the layer or selection.</dd>
3940
* </dl>
4041
*
41-
* \since QGIS 3.0
42+
* @note Added in QGIS 3.0
4243
*/
4344

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

4849
/**
4950
* Creates a new invalid action scope.
51+
*
52+
* @note Added in QGSI 3.0
5053
*/
5154
explicit QgsActionScope();
5255

‎src/core/qgsactionscoperegistry.h

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,24 @@
3737
class CORE_EXPORT QgsActionScopeRegistry : public QObject
3838
{
3939
Q_OBJECT
40-
/**
41-
* The action scopes which are currently registered and available.
42-
*
43-
* \read actionScopes()
44-
* \notify actionScopesChanged()
45-
*
46-
* \since QGIS 3.0
47-
*/
4840
Q_PROPERTY( QSet<QgsActionScope> actionScopes READ actionScopes NOTIFY actionScopesChanged )
4941

5042
public:
43+
44+
/**
45+
* Create a new QgsActionScopeRegistry.
46+
* QGIS already creates a central registry. You will normally
47+
* want to use QgsApplication::actionScopeRegistry() to get acess
48+
* to that one instead.
49+
*
50+
* @note Added in QGIS 3.0
51+
*/
5152
explicit QgsActionScopeRegistry( QObject* parent = nullptr );
5253

5354
/**
5455
* Get all registered action scopes.
56+
*
57+
* @note Added in QGIS 3.0
5558
*/
5659
QSet<QgsActionScope> actionScopes() const;
5760

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

75+
/**
76+
* Get an action scope by its id.
77+
*
78+
* @note Added in QGIS 3.0
79+
*/
7280
QgsActionScope actionScope( const QString& id );
7381

7482
signals:
83+
84+
/**
85+
* Emitted whenever a new action scope is registered or an action scope
86+
* is unregistered.
87+
*
88+
* @note Added in QGIS 3.0
89+
*/
7590
void actionScopesChanged();
7691

7792
private:

‎src/core/qgsapplication.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,8 @@ class CORE_EXPORT QgsApplication : public QApplication
376376

377377
/**
378378
* Returns the action scope registry.
379+
*
380+
* @Note Added in QGIS 3.0
379381
*/
380382
static QgsActionScopeRegistry* actionScopeRegistry();
381383

‎src/gui/qgsactionmenu.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class GUI_EXPORT QgsActionMenu : public QMenu
6262
* @param feature The feature that this action will be run upon. Make sure that this feature is available
6363
* for the lifetime of this object.
6464
* @param parent The usual QWidget parent.
65+
* @param actionScope The action scope this menu will run in
6566
*/
6667
explicit QgsActionMenu( QgsVectorLayer* layer, const QgsFeature& feature, const QString& actionScope, QWidget *parent = nullptr );
6768

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

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

92+
signals:
93+
void reinit();
94+
9095
private slots:
9196
void triggerAction();
9297
void reloadActions();
9398

94-
signals:
95-
void reinit();
96-
9799
private:
98100
void init();
99101
QgsFeature feature();

0 commit comments

Comments
 (0)
Please sign in to comment.