Navigation Menu

Skip to content

Commit

Permalink
Add note about Python bindings in QgsAction
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry authored and nyalldawson committed Oct 12, 2020
1 parent 00ccfc8 commit dbe2a3b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
10 changes: 8 additions & 2 deletions python/core/auto_generated/qgsaction.sip.in
Expand Up @@ -42,7 +42,7 @@ Create a new QgsAction
:param description: A human readable description string
:param command: The action text. Its interpretation depends on the type
:param capture: If this is set to ``True``, the output will be captured when an action is run
:param enabledOnlyWhenEditable: if ``True`` then action is only enable in editmode
:param enabledOnlyWhenEditable: if ``True`` then action is only enable in editmode. Not available in Python bindings.
%End

QgsAction( ActionType type, const QString &description, const QString &action, const QString &icon, bool capture, const QString &shortTitle = QString(), const QSet<QString> &actionScopes = QSet<QString>(), const QString &notificationMessage = QString() );
Expand All @@ -57,7 +57,7 @@ Create a new QgsAction
:param shortTitle: A short string used to label user interface elements like buttons
:param actionScopes: A set of scopes in which this action will be available
:param notificationMessage: A particular message which reception will trigger the action
:param enabledOnlyWhenEditable: if ``True`` then action is only enable in editmode
:param enabledOnlyWhenEditable: if ``True`` then action is only enable in editmode. Not available in Python bindings.
%End

QString name() const;
Expand Down Expand Up @@ -126,6 +126,12 @@ Whether to capture output for display when this action is run
Returns whether only enabled in editable mode
%End

void setEnabledOnlyWhenEditable( bool enable );
%Docstring
Set whether the action is only enabled in editable mode

.. versionadded:: 3.16
%End

bool runable() const;
%Docstring
Expand Down
11 changes: 9 additions & 2 deletions src/core/qgsaction.h
Expand Up @@ -57,7 +57,7 @@ class CORE_EXPORT QgsAction
* \param description A human readable description string
* \param command The action text. Its interpretation depends on the type
* \param capture If this is set to TRUE, the output will be captured when an action is run
* \param enabledOnlyWhenEditable if TRUE then action is only enable in editmode
* \param enabledOnlyWhenEditable if TRUE then action is only enable in editmode. Not available in Python bindings.
*/
#ifndef SIP_RUN
QgsAction( ActionType type, const QString &description, const QString &command, bool capture = false, bool enabledOnlyWhenEditable = false )
Expand Down Expand Up @@ -90,7 +90,7 @@ class CORE_EXPORT QgsAction
* \param shortTitle A short string used to label user interface elements like buttons
* \param actionScopes A set of scopes in which this action will be available
* \param notificationMessage A particular message which reception will trigger the action
* \param enabledOnlyWhenEditable if TRUE then action is only enable in editmode
* \param enabledOnlyWhenEditable if TRUE then action is only enable in editmode. Not available in Python bindings.
*/
#ifndef SIP_RUN
QgsAction( ActionType type, const QString &description, const QString &action, const QString &icon, bool capture, const QString &shortTitle = QString(), const QSet<QString> &actionScopes = QSet<QString>(), const QString &notificationMessage = QString(), bool enabledOnlyWhenEditable = false )
Expand Down Expand Up @@ -172,6 +172,13 @@ class CORE_EXPORT QgsAction
//! Returns whether only enabled in editable mode
bool isEnabledOnlyWhenEditable() const { return mIsEnabledOnlyWhenEditable; }

/**
* Set whether the action is only enabled in editable mode
*
* \since QGIS 3.16
*/
void setEnabledOnlyWhenEditable( bool enable ) { mIsEnabledOnlyWhenEditable = enable; };


//! Checks if the action is runable on the current platform
bool runable() const;
Expand Down

0 comments on commit dbe2a3b

Please sign in to comment.