Web Analytics Made Easy - Statcounter
Skip to content

Class SBGAction#

ClassList > 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.

void SBGAction::onTriggerEvent;

Parameters:

  • b Unused boolean parameter.

Public Signals Documentation#

signal actionEnd#

The signal that can be emitted (optional) when the action end.

void SBGAction::actionEnd;


signal actionStart#

The signal that can be emitted (optional) when the action starts.

void SBGAction::actionStart;


signal donePercent#

The signal that can be emitted (optional) to indicate the progress of the action.

void SBGAction::donePercent;


signal doneText#

The signal that can be emitted (optional) to indicate the progress of the action.

void SBGAction::doneText;


signal favorited#

The action has been added to favorites or removed from favorites.

void SBGAction::favorited;


Public Functions Documentation#

function SBGAction [1/4]#

Builds an action.

SBGAction::SBGAction (
    QObject * parent,
    bool isDiscoverable=true
) 

Constructs an action with a default UUID.

Parameters:

  • parent The parent QObject of the action.
  • isDiscoverable Indicates 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:

  • uuid The universally unique identifier for the action.
  • parent The parent QObject of the action.
  • isDiscoverable Indicates 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:

  • text The display text of the action.
  • uuid The universally unique identifier for the action.
  • parent The parent QObject of the action.
  • isDiscoverable Indicates 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:

  • icon The icon displayed for the action.
  • text The display text of the action.
  • uuid The universally unique identifier for the action.
  • parent The parent QObject of the action.
  • isDiscoverable Indicates 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 .

bool SBGAction::getAddableToFavoritesFlag () const

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.

unsigned int SBGAction::getBadge () const

Returns the badge value associated with the action.

Returns:

The badge value.


function getBadgeBackgroundColor#

Returns the badge background color.

QColor SBGAction::getBadgeBackgroundColor () const

Returns the background color used for the badge.

Returns:

The badge background color.


function getBadgeTextColor#

Returns the badge text color.

QColor SBGAction::getBadgeTextColor () const

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.

virtual QString SBGAction::getDescriptionImagePath () const

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.

bool SBGAction::getFavoriteFlag () const

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.

SBNode * SBGAction::getHighlightedNode () const

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.

bool SBGAction::getHighlightingFlag () const

Returns whether highlighting is enabled for the action.

Returns:

true if highlighting is enabled; otherwise false.


function getName#

Returns the action's class name.

virtual QString SBGAction::getName () const

Returns the class name of the action.

Returns:

The name of the action class.


function getUUID#

Returns the action's UUID.

virtual SBUUID SBGAction::getUUID () const

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.

bool SBGAction::hasFavoriteFlag () const

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.

virtual bool SBGAction::isDiscoverable () const

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.

virtual bool SBGAction::isLocked () const

Indicates whether the action is locked.

Returns:

true if the action is locked; otherwise false.


function refresh#

Refresh all widgets containing the action.

void SBGAction::refresh () 

Refreshes all widgets associated with the action, updating their visual appearance.


function run#

Runs the action on nodes in the nodeIndexer .

virtual void SBGAction::run (
    const SBNodeIndexer & 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:

  • nodeIndexer An 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.

void SBGAction::setAddableToFavoritesFlag (
    bool b
) 

Sets whether the action can be added to favorites and updates signal connections accordingly.

Parameters:

  • b true to allow adding to favorites; false to disallow.

function setBadge#

Sets the badge.

void SBGAction::setBadge (
    unsigned int badge
) 

Sets the badge value for the action and refreshes associated widgets.

Parameters:

  • badge The badge value to set.

function setBadgeBackgroundColor#

Sets the badge background color.

void SBGAction::setBadgeBackgroundColor (
    const QColor & badgeBackgroundColor
) 

Sets the background color for the badge and refreshes associated widgets.

Parameters:

  • badgeBackgroundColor The color to use for badge background.

function setBadgeTextColor#

Sets the badge text color.

void SBGAction::setBadgeTextColor (
    const QColor & badgeTextColor
) 

Sets the text color for the badge and refreshes associated widgets.

Parameters:

  • badgeTextColor The color to use for badge text.

function setFavoriteFlag#

Sets the favorite flag.

void SBGAction::setFavoriteFlag (
    bool favoriteFlag
) 

Sets the favorite status of the action and emits the corresponding signal.

Parameters:

  • favoriteFlag true to mark as favorite; false to unmark.

function setHighlightedNode#

Sets the highlighted node.

void SBGAction::setHighlightedNode (
    SBNode * highlightedNode
) 

Sets the node to be highlighted by the action.

Parameters:

  • highlightedNode A pointer to the node to highlight.

function setHighlightingFlag#

Sets the highlighting flag.

void SBGAction::setHighlightingFlag (
    bool highlightingFlag
) 

Enables or disables highlighting for the action.

Parameters:

  • highlightingFlag true to enable highlighting; false to disable.

function setIconFilename#

Define icon filename, icon file should be in current skin icon path.

void SBGAction::setIconFilename (
    const QString & filename="SAMSON.png"
) 

Sets the action's icon from a file located in the current skin icon path.

Parameters:

  • filename The name of the icon file.

function setIconPathname#

Define icon pathname, icon file can have an arbitrary path.

void SBGAction::setIconPathname (
    const QString & filename
) 

Sets the action's icon from an absolute file path.

Parameters:

  • filename The absolute path to the icon file.

function setIconPixmap#

Define icon based on a given pixmap.

void SBGAction::setIconPixmap (
    const QPixmap & pixmap
) 

Sets the action's icon using a pixmap and creates a disabled version.

Parameters:

  • normalPixmap The pixmap to use for the normal state of the icon.

function ~SBGAction#

Destructor.

virtual SBGAction::~SBGAction () 

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.

static QIcon SBGAction::makeIcon (
    const QString & filename
) 

Creates an icon from the specified image file.

Parameters:

  • filename The 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.

static QIcon SBGAction::makeIcon (
    const QPixmap & normalPixmap
) 

Creates an icon from the specified pixmap, generating both normal and disabled versions.

Parameters:

  • normalPixmap The 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.

SBGActionData* SBGAction::dataPointer;


Protected Functions Documentation#

function event#

Handles events.

bool SBGAction::event (
    QEvent * e
) override

Handles events for the action, integrating analytics and shortcut handling.

Parameters:

  • e The event to process.

Returns:

true if the event was handled; otherwise false.