Skip to content

Commit 2520c28

Browse files
signedavnyalldawson
authored andcommitted
skip enabledOnlyWhenEditable from pyhton bindings
in the construtors of QgsAction and QgsMapLayerAction
1 parent 1b66922 commit 2520c28

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

src/core/qgsaction.h

+26
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class CORE_EXPORT QgsAction
5959
* \param capture If this is set to true, the output will be captured when an action is run
6060
* \param enabledOnlyWhenEditable if true then action is only enable in editmode
6161
*/
62+
#ifndef SIP_RUN
6263
QgsAction( ActionType type, const QString &description, const QString &command, bool capture = false, bool enabledOnlyWhenEditable = false )
6364
: mType( type )
6465
, mDescription( description )
@@ -67,6 +68,16 @@ class CORE_EXPORT QgsAction
6768
, mId( QUuid::createUuid() )
6869
, mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
6970
{}
71+
#else
72+
QgsAction( ActionType type, const QString &description, const QString &command, bool capture = false )
73+
: mType( type )
74+
, mDescription( description )
75+
, mCommand( command )
76+
, mCaptureOutput( capture )
77+
, mId( QUuid::createUuid() )
78+
, mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
79+
{}
80+
#endif
7081

7182
/**
7283
* Create a new QgsAction
@@ -81,6 +92,7 @@ class CORE_EXPORT QgsAction
8192
* \param notificationMessage A particular message which reception will trigger the action
8293
* \param enabledOnlyWhenEditable if true then action is only enable in editmode
8394
*/
95+
#ifndef SIP_RUN
8496
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 )
8597
: mType( type )
8698
, mDescription( description )
@@ -93,6 +105,20 @@ class CORE_EXPORT QgsAction
93105
, mId( QUuid::createUuid() )
94106
, mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
95107
{}
108+
#else
109+
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() )
110+
: mType( type )
111+
, mDescription( description )
112+
, mShortTitle( shortTitle )
113+
, mIcon( icon )
114+
, mCommand( action )
115+
, mCaptureOutput( capture )
116+
, mActionScopes( actionScopes )
117+
, mNotificationMessage( notificationMessage )
118+
, mId( QUuid::createUuid() )
119+
, mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
120+
{}
121+
#endif
96122

97123
//! The name of the action. This may be a longer description.
98124
QString name() const { return mDescription; }

src/gui/qgsmaplayeractionregistry.h

+12-3
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,23 @@ class GUI_EXPORT QgsMapLayerAction : public QAction
5050
* Creates a map layer action which can run on any layer
5151
* \note using AllActions as a target probably does not make a lot of sense. This default action was settled for API compatibility reasons.
5252
*/
53+
#ifndef SIP_RUN
5354
QgsMapLayerAction( const QString &name, QObject *parent SIP_TRANSFERTHIS, Targets targets = AllActions, const QIcon &icon = QIcon(), const bool enabledOnlyWhenEditable = false );
54-
55+
#else
56+
QgsMapLayerAction( const QString &name, QObject *parent SIP_TRANSFERTHIS, Targets targets = AllActions, const QIcon &icon = QIcon() );
57+
#endif
5558
//! Creates a map layer action which can run only on a specific layer
59+
#ifndef SIP_RUN
5660
QgsMapLayerAction( const QString &name, QObject *parent SIP_TRANSFERTHIS, QgsMapLayer *layer, Targets targets = AllActions, const QIcon &icon = QIcon(), const bool enabledOnlyWhenEditable = false );
57-
61+
#else
62+
QgsMapLayerAction( const QString &name, QObject *parent SIP_TRANSFERTHIS, QgsMapLayer *layer, Targets targets = AllActions, const QIcon &icon = QIcon() );
63+
#endif
5864
//! Creates a map layer action which can run on a specific type of layer
65+
#ifndef SIP_RUN
5966
QgsMapLayerAction( const QString &name, QObject *parent SIP_TRANSFERTHIS, QgsMapLayer::LayerType layerType, Targets targets = AllActions, const QIcon &icon = QIcon(), const bool enabledOnlyWhenEditable = false );
60-
67+
#else
68+
QgsMapLayerAction( const QString &name, QObject *parent SIP_TRANSFERTHIS, QgsMapLayer::LayerType layerType, Targets targets = AllActions, const QIcon &icon = QIcon() );
69+
#endif
6170
~QgsMapLayerAction() override;
6271

6372
//! True if action can run using the specified layer

0 commit comments

Comments
 (0)