19 #include "qgis_core.h" 63 QgsAction(
ActionType type,
const QString &description,
const QString &command,
bool capture =
false,
bool enabledOnlyWhenEditable =
false )
65 , mDescription( description )
67 , mCaptureOutput( capture )
68 , mId( QUuid::createUuid() )
69 , mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
72 QgsAction(
ActionType type,
const QString &description,
const QString &command,
bool capture =
false )
74 , mDescription( description )
76 , mCaptureOutput( capture )
77 , mId( QUuid::createUuid() )
78 , mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
96 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 ¬ificationMessage = QString(),
bool enabledOnlyWhenEditable =
false )
98 , mDescription( description )
99 , mShortTitle( shortTitle )
102 , mCaptureOutput( capture )
103 , mActionScopes( actionScopes )
104 , mNotificationMessage( notificationMessage )
105 , mId( QUuid::createUuid() )
106 , mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
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 ¬ificationMessage = QString() )
111 , mDescription( description )
112 , mShortTitle( shortTitle )
115 , mCaptureOutput( capture )
116 , mActionScopes( actionScopes )
117 , mNotificationMessage( notificationMessage )
118 , mId( QUuid::createUuid() )
119 , mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
124 QString
name()
const {
return mDescription; }
134 QUuid
id()
const {
return mId; }
141 bool isValid()
const {
return !mId.isNull(); }
147 QIcon
icon()
const {
return QIcon( mIcon ); }
169 bool capture()
const {
return mCaptureOutput; }
177 bool runable()
const;
201 QSet<QString> actionScopes()
const;
210 void setActionScopes(
const QSet<QString> &actionScopes );
218 void readXml(
const QDomNode &actionNode );
226 void writeXml( QDomNode &actionsNode )
const;
244 QString mDescription;
248 bool mCaptureOutput =
false;
249 QSet<QString> mActionScopes;
250 QString mNotificationMessage;
251 mutable std::shared_ptr<QAction> mAction;
254 bool mIsEnabledOnlyWhenEditable =
false;
259 #endif // QGSACTION_H
QString notificationMessage() const
Returns the notification message that triggers the action.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Q_DECLARE_METATYPE(QModelIndex)
bool capture() const
Whether to capture output for display when this action is run.
bool isValid() const
Returns true if this action was a default constructed one.
QString name() const
The name of the action. This may be a longer description.
Utility class that encapsulates an action based on vector attributes.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Single scope for storing variables and functions for use within a QgsExpressionContext.
QUuid id() const
Returns a unique id for this action.
QString command() const
Returns the command that is executed by this action.
ActionType type() const
The action type.
QString iconPath() const
The path to the icon.
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 ¬ificationMessage=QString(), bool enabledOnlyWhenEditable=false)
Create a new QgsAction.
QString shortTitle() const
The short title is used to label user interface elements like buttons.
Represents a vector layer which manages a vector based data sets.
bool isEnabledOnlyWhenEditable() const
Returns whether only enabled in editable mode.
QIcon icon() const
The icon.
QgsAction(ActionType type, const QString &description, const QString &command, bool capture=false, bool enabledOnlyWhenEditable=false)
Create a new QgsAction.