Class SBGAction#
Inherits the following classes: QAction
Public Slots#
| Type | Name |
|---|---|
| slot void | onTriggerEvent (bool b) Slot called when the action is triggered. |
Public Signals#
| Type | Name |
|---|---|
| signal void | actionEnd (bool) The signal that can be emitted (optional) when the action end. |
| signal void | actionStart (bool) The signal that can be emitted (optional) when the action starts. |
| signal void | donePercent (int) The signal that can be emitted (optional) to indicate the progress of the action. |
| signal void | doneText (const QString &) The signal that can be emitted (optional) to indicate the progress of the action. |
| signal void | favorited (bool) The action has been added to favorites or removed from favorites. |
Public Functions#
| Type | Name |
|---|---|
| SBGAction (QObject * parent, bool isDiscoverable=true) Builds an action. |
|
| SBGAction (const SBUUID & uuid=SBUUID(), QObject * parent=nullptr, bool isDiscoverable=true) Builds an action with UUID uuid . |
|
| SBGAction (const QString & text, const SBUUID & uuid=SBUUID(), QObject * parent=nullptr, bool isDiscoverable=true) Builds an action with text text and UUIDuuid . |
|
| SBGAction (const QIcon & icon, const QString & text, const SBUUID & uuid=SBUUID(), QObject * parent=nullptr, bool isDiscoverable=true) Builds an action with icon icon , texttext , and UUIDuuid . |
|
| bool | getAddableToFavoritesFlag () const Returns true if the action can be added to favorites. By default, the flag istrue . |
| unsigned int | getBadge () const Returns the badge. |
| QColor | getBadgeBackgroundColor () const Returns the badge background color. |
| QColor | getBadgeTextColor () const Returns the badge text color. |
| virtual QString | getDescriptionImagePath () const Returns a path to an image which will be placed into the action's description. If not specified, the action's icon might be used instead. |
| bool | getFavoriteFlag () const Returns the favorite flag. |
| SBNode * | getHighlightedNode () const Returns the highlighted node. |
| bool | getHighlightingFlag () const Returns the highlighting flag. |
| virtual QString | getName () const Returns the action's class name. |
| virtual SBUUID | getUUID () const Returns the action's UUID. |
| bool | hasFavoriteFlag () const Returns true if the action has the favorite flag, i.e. whether it complies with criteria that make it possible to add it to favorites. |
| virtual bool | isDiscoverable () const Returns true if can be discovered by the user. |
| virtual bool | isLocked () const Returns true if the action is locked. |
| void | refresh () Refresh all widgets containing the action. |
| virtual void | run (const SBNodeIndexer & nodeIndexer) Runs the action on nodes in the nodeIndexer . |
| void | setAddableToFavoritesFlag (bool b) Sets whether the action can be added to favorites. It also connects/disconnect the 'favorited' signal. By default, all actions are addable to favorites (once they've been registered). Change the "addableToFavorites" flag in workspace XML to modify this parameter. |
| void | setBadge (unsigned int badge) Sets the badge. |
| void | setBadgeBackgroundColor (const QColor & badgeBackgroundColor) Sets the badge background color. |
| void | setBadgeTextColor (const QColor & badgeTextColor) Sets the badge text color. |
| void | setFavoriteFlag (bool favoriteFlag) Sets the favorite flag. |
| void | setHighlightedNode (SBNode * highlightedNode) Sets the highlighted node. |
| void | setHighlightingFlag (bool highlightingFlag) Sets the highlighting flag. |
| void | setIconFilename (const QString & filename="SAMSON.png") Define icon filename, icon file should be in current skin icon path. |
| void | setIconPathname (const QString & filename) Define icon pathname, icon file can have an arbitrary path. |
| void | setIconPixmap (const QPixmap & pixmap) Define icon based on a given pixmap. |
| virtual | ~SBGAction () Destructor. |
Public Static Functions#
| Type | Name |
|---|---|
| QIcon | makeIcon (const QString & filename) Make an icon, with both a normal and disabled version, from a filename that includes the absolute path to an image. |
| QIcon | makeIcon (const QPixmap & normalPixmap) Make an icon, with both a normal and disabled version, from a normal pixmap. |
Protected Attributes#
| Type | Name |
|---|---|
| SBGActionData * | dataPointer A pointer to the private data. |
Protected Functions#
| Type | Name |
|---|---|
| bool | event (QEvent * e) override Handles events. |
Public Slots Documentation#
slot onTriggerEvent#
Slot called when the action is triggered.
Parameters:
bUnused boolean parameter.
Public Signals Documentation#
signal actionEnd#
The signal that can be emitted (optional) when the action end.
signal actionStart#
The signal that can be emitted (optional) when the action starts.
signal donePercent#
The signal that can be emitted (optional) to indicate the progress of the action.
signal doneText#
The signal that can be emitted (optional) to indicate the progress of the action.
signal favorited#
The action has been added to favorites or removed from favorites.
Public Functions Documentation#
function SBGAction [1/4]#
Builds an action.
Constructs an action with a default UUID.
Parameters:
parentThe parent QObject of the action.isDiscoverableIndicates whether the action can be discovered by the user.
function SBGAction [2/4]#
Builds an action with UUID uuid .
SBGAction::SBGAction (
const SBUUID & uuid=SBUUID (),
QObject * parent=nullptr,
bool isDiscoverable=true
)
Constructs an action with the specified UUID.
Parameters:
uuidThe universally unique identifier for the action.parentThe parent QObject of the action.isDiscoverableIndicates whether the action can be discovered by the user.
function SBGAction [3/4]#
Builds an action with text text and UUIDuuid .
SBGAction::SBGAction (
const QString & text,
const SBUUID & uuid=SBUUID (),
QObject * parent=nullptr,
bool isDiscoverable=true
)
Constructs an action with the given text and UUID.
Parameters:
textThe display text of the action.uuidThe universally unique identifier for the action.parentThe parent QObject of the action.isDiscoverableIndicates whether the action can be discovered by the user.
function SBGAction [4/4]#
Builds an action with icon icon , texttext , and UUIDuuid .
SBGAction::SBGAction (
const QIcon & icon,
const QString & text,
const SBUUID & uuid=SBUUID (),
QObject * parent=nullptr,
bool isDiscoverable=true
)
Constructs an action with the specified icon, text, and UUID.
Parameters:
iconThe icon displayed for the action.textThe display text of the action.uuidThe universally unique identifier for the action.parentThe parent QObject of the action.isDiscoverableIndicates whether the action can be discovered by the user.
function getAddableToFavoritesFlag#
Returns true if the action can be added to favorites. By default, the flag istrue .
Returns whether the action can be added to favorites.
Returns:
true if the action can be added to favorites; otherwise false.
function getBadge#
Returns the badge.
Returns the badge value associated with the action.
Returns:
The badge value.
function getBadgeBackgroundColor#
Returns the badge background color.
Returns the background color used for the badge.
Returns:
The badge background color.
function getBadgeTextColor#
Returns the badge text color.
Returns the text color used for the badge.
Returns:
The badge text color.
function getDescriptionImagePath#
Returns a path to an image which will be placed into the action's description. If not specified, the action's icon might be used instead.
Returns the path to an image used in the action's description.
Returns:
A string containing the image path, or an empty string if none is set.
function getFavoriteFlag#
Returns the favorite flag.
Returns whether the action is currently marked as a favorite.
Returns:
true if the action is a favorite; otherwise false.
function getHighlightedNode#
Returns the highlighted node.
Returns the node that is highlighted by the action.
Returns:
A pointer to the highlighted node, or nullptr if none is set.
function getHighlightingFlag#
Returns the highlighting flag.
Returns whether highlighting is enabled for the action.
Returns:
true if highlighting is enabled; otherwise false.
function getName#
Returns the action's class name.
Returns the class name of the action.
Returns:
The name of the action class.
function getUUID#
Returns the action's UUID.
Returns the universally unique identifier of the action.
Returns:
The UUID of the action.
function hasFavoriteFlag#
Returns true if the action has the favorite flag, i.e. whether it complies with criteria that make it possible to add it to favorites.
Determines whether the action can be added to favorites.
Returns:
true if the action is eligible to be added to favorites; otherwise false.
function isDiscoverable#
Returns true if can be discovered by the user.
Indicates whether the action can be discovered by the user.
Returns:
true if the action is discoverable; otherwise false.
function isLocked#
Returns true if the action is locked.
Indicates whether the action is locked.
Returns:
true if the action is locked; otherwise false.
function refresh#
Refresh all widgets containing the action.
Refreshes all widgets associated with the action, updating their visual appearance.
function run#
Runs the action on nodes in the nodeIndexer .
This is a specialized function that runs this action on nodes in the nodeIndexer.
By default, when an action is triggered (via the SBGAction::trigger function or by triggering it via UI) it is applied to the whole document or to the current selection depending on the action's implementation. If you want make it possible to apply an action to nodes in a node indexer without the need to first select such nodes, then you need to implement this function.
Parameters:
nodeIndexerAn indexer of nodes to which the action should be applied
function setAddableToFavoritesFlag#
Sets whether the action can be added to favorites. It also connects/disconnect the 'favorited' signal. By default, all actions are addable to favorites (once they've been registered). Change the "addableToFavorites" flag in workspace XML to modify this parameter.
Sets whether the action can be added to favorites and updates signal connections accordingly.
Parameters:
btrueto allow adding to favorites;falseto disallow.
function setBadge#
Sets the badge.
Sets the badge value for the action and refreshes associated widgets.
Parameters:
badgeThe badge value to set.
function setBadgeBackgroundColor#
Sets the badge background color.
Sets the background color for the badge and refreshes associated widgets.
Parameters:
badgeBackgroundColorThe color to use for badge background.
function setBadgeTextColor#
Sets the badge text color.
Sets the text color for the badge and refreshes associated widgets.
Parameters:
badgeTextColorThe color to use for badge text.
function setFavoriteFlag#
Sets the favorite flag.
Sets the favorite status of the action and emits the corresponding signal.
Parameters:
favoriteFlagtrueto mark as favorite;falseto unmark.
function setHighlightedNode#
Sets the highlighted node.
Sets the node to be highlighted by the action.
Parameters:
highlightedNodeA pointer to the node to highlight.
function setHighlightingFlag#
Sets the highlighting flag.
Enables or disables highlighting for the action.
Parameters:
highlightingFlagtrueto enable highlighting;falseto disable.
function setIconFilename#
Define icon filename, icon file should be in current skin icon path.
Sets the action's icon from a file located in the current skin icon path.
Parameters:
filenameThe name of the icon file.
function setIconPathname#
Define icon pathname, icon file can have an arbitrary path.
Sets the action's icon from an absolute file path.
Parameters:
filenameThe absolute path to the icon file.
function setIconPixmap#
Define icon based on a given pixmap.
Sets the action's icon using a pixmap and creates a disabled version.
Parameters:
normalPixmapThe pixmap to use for the normal state of the icon.
function ~SBGAction#
Destructor.
Destroys the action and releases associated resources.
Public Static Functions Documentation#
function makeIcon [1/2]#
Make an icon, with both a normal and disabled version, from a filename that includes the absolute path to an image.
Creates an icon from the specified image file.
Parameters:
filenameThe path to the image file.
Returns:
An icon containing normal and disabled versions derived from the image.
function makeIcon [2/2]#
Make an icon, with both a normal and disabled version, from a normal pixmap.
Creates an icon from the specified pixmap, generating both normal and disabled versions.
Parameters:
normalPixmapThe pixmap to use for the normal state of the icon.
Returns:
An icon containing the normal and disabled pixmaps.
Protected Attributes Documentation#
variable dataPointer#
A pointer to the private data.
Protected Functions Documentation#
function event#
Handles events.
Handles events for the action, integrating analytics and shortcut handling.
Parameters:
eThe event to process.
Returns:
true if the event was handled; otherwise false.