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; }
184 bool runable()
const;
208 QSet<QString> actionScopes()
const;
217 void setActionScopes(
const QSet<QString> &actionScopes );
225 void readXml(
const QDomNode &actionNode );
233 void writeXml( QDomNode &actionsNode )
const;
250 ActionType mType = Generic;
251 QString mDescription;
255 bool mCaptureOutput =
false;
256 QSet<QString> mActionScopes;
257 QString mNotificationMessage;
258 mutable std::shared_ptr<QAction> mAction;
261 bool mIsEnabledOnlyWhenEditable =
false;
Utility class that encapsulates an action based on vector attributes.
QgsAction(ActionType type, const QString &description, const QString &command, bool capture=false, bool enabledOnlyWhenEditable=false)
Create a new QgsAction.
void setEnabledOnlyWhenEditable(bool enable)
Set whether the action is only enabled in editable mode.
QString notificationMessage() const
Returns the notification message that triggers the action.
QString name() const
The name of the action. This may be a longer description.
QgsAction()=default
Default constructor.
QIcon icon() const
The icon.
QString iconPath() const
The path to the icon.
bool isValid() const
Returns true if this action was a default constructed one.
ActionType type() const
The action type.
QString command() const
Returns the command that is executed by this action.
QString shortTitle() const
The short title is used to label user interface elements like buttons.
bool isEnabledOnlyWhenEditable() const
Returns whether only enabled in editable mode.
bool capture() const
Whether to capture output for display when this action is run.
QUuid id() const
Returns a unique id for this action.
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.
Single scope for storing variables and functions for use within a QgsExpressionContext.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Represents a vector layer which manages a vector based data sets.
Q_DECLARE_METATYPE(QgsMeshTimeSettings)