Skip to content

Commit

Permalink
skip enabledOnlyWhenEditable from pyhton bindings
Browse files Browse the repository at this point in the history
in the construtors of QgsAction and QgsMapLayerAction
  • Loading branch information
signedav committed Feb 23, 2018
1 parent 55a8d41 commit 555cdf0
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
26 changes: 26 additions & 0 deletions src/core/qgsaction.h
Expand Up @@ -59,6 +59,7 @@ class CORE_EXPORT QgsAction
* \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
*/
#ifndef SIP_RUN
QgsAction( ActionType type, const QString &description, const QString &command, bool capture = false, bool enabledOnlyWhenEditable = false )
: mType( type )
, mDescription( description )
Expand All @@ -67,6 +68,16 @@ class CORE_EXPORT QgsAction
, mId( QUuid::createUuid() )
, mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
{}
#else
QgsAction( ActionType type, const QString &description, const QString &command, bool capture = false )
: mType( type )
, mDescription( description )
, mCommand( command )
, mCaptureOutput( capture )
, mId( QUuid::createUuid() )
, mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
{}
#endif

/**
* Create a new QgsAction
Expand All @@ -81,6 +92,7 @@ class CORE_EXPORT QgsAction
* \param notificationMessage A particular message which reception will trigger the action
* \param enabledOnlyWhenEditable if true then action is only enable in editmode
*/
#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 )
: mType( type )
, mDescription( description )
Expand All @@ -93,6 +105,20 @@ class CORE_EXPORT QgsAction
, mId( QUuid::createUuid() )
, mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
{}
#else
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() )
: mType( type )
, mDescription( description )
, mShortTitle( shortTitle )
, mIcon( icon )
, mCommand( action )
, mCaptureOutput( capture )
, mActionScopes( actionScopes )
, mNotificationMessage( notificationMessage )
, mId( QUuid::createUuid() )
, mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
{}
#endif

//! The name of the action. This may be a longer description.
QString name() const { return mDescription; }
Expand Down
15 changes: 12 additions & 3 deletions src/gui/qgsmaplayeractionregistry.h
Expand Up @@ -50,14 +50,23 @@ class GUI_EXPORT QgsMapLayerAction : public QAction
* Creates a map layer action which can run on any layer
* \note using AllActions as a target probably does not make a lot of sense. This default action was settled for API compatibility reasons.
*/
#ifndef SIP_RUN
QgsMapLayerAction( const QString &name, QObject *parent SIP_TRANSFERTHIS, Targets targets = AllActions, const QIcon &icon = QIcon(), const bool enabledOnlyWhenEditable = false );

#else
QgsMapLayerAction( const QString &name, QObject *parent SIP_TRANSFERTHIS, Targets targets = AllActions, const QIcon &icon = QIcon() );
#endif
//! Creates a map layer action which can run only on a specific layer
#ifndef SIP_RUN
QgsMapLayerAction( const QString &name, QObject *parent SIP_TRANSFERTHIS, QgsMapLayer *layer, Targets targets = AllActions, const QIcon &icon = QIcon(), const bool enabledOnlyWhenEditable = false );

#else
QgsMapLayerAction( const QString &name, QObject *parent SIP_TRANSFERTHIS, QgsMapLayer *layer, Targets targets = AllActions, const QIcon &icon = QIcon() );
#endif
//! Creates a map layer action which can run on a specific type of layer
#ifndef SIP_RUN
QgsMapLayerAction( const QString &name, QObject *parent SIP_TRANSFERTHIS, QgsMapLayer::LayerType layerType, Targets targets = AllActions, const QIcon &icon = QIcon(), const bool enabledOnlyWhenEditable = false );

#else
QgsMapLayerAction( const QString &name, QObject *parent SIP_TRANSFERTHIS, QgsMapLayer::LayerType layerType, Targets targets = AllActions, const QIcon &icon = QIcon() );
#endif
~QgsMapLayerAction() override;

//! True if action can run using the specified layer
Expand Down

0 comments on commit 555cdf0

Please sign in to comment.