Web Analytics Made Easy - Statcounter
Skip to content

Class SBGAction#

ClassList > SBGAction

This class is the base class for actions. More...

  • #include "SBGAction.hpp"

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 .
SB_DECLARE_DATA (SBGAction)
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.

Detailed Description#

Short name: SBAction

Public Slots Documentation#

slot onTriggerEvent#

Slot called when the action is triggered.

void SBGAction::onTriggerEvent;


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
) 


function SBGAction [2/4]#

Builds an action with UUID uuid .

SBGAction::SBGAction (
    const SBUUID & uuid=SBUUID (),
    QObject * parent=nullptr,
    bool isDiscoverable=true
) 


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
) 


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
) 


function SB_DECLARE_DATA#

SBGAction::SB_DECLARE_DATA (
    SBGAction
) 

function getAddableToFavoritesFlag#

Returns true if the action can be added to favorites. By default, the flag istrue .

bool SBGAction::getAddableToFavoritesFlag () const


function getBadge#

Returns the badge.

unsigned int SBGAction::getBadge () const


function getBadgeBackgroundColor#

Returns the badge background color.

QColor SBGAction::getBadgeBackgroundColor () const


function getBadgeTextColor#

Returns the badge text color.

QColor SBGAction::getBadgeTextColor () const


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


function getFavoriteFlag#

Returns the favorite flag.

bool SBGAction::getFavoriteFlag () const


function getHighlightedNode#

Returns the highlighted node.

SBNode * SBGAction::getHighlightedNode () const


function getHighlightingFlag#

Returns the highlighting flag.

bool SBGAction::getHighlightingFlag () const


function getName#

Returns the action's class name.

virtual QString SBGAction::getName () const


function getUUID#

Returns the action's UUID.

virtual SBUUID SBGAction::getUUID () const


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


function isDiscoverable#

Returns true if can be discovered by the user.

virtual bool SBGAction::isDiscoverable () const


function isLocked#

Returns true if the action is locked.

virtual bool SBGAction::isLocked () const


function refresh#

Refresh all widgets containing the action.

void SBGAction::refresh () 


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 to 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
) 


function setBadge#

Sets the badge.

void SBGAction::setBadge (
    unsigned int badge
) 


function setBadgeBackgroundColor#

Sets the badge background color.

void SBGAction::setBadgeBackgroundColor (
    const QColor & badgeBackgroundColor
) 


function setBadgeTextColor#

Sets the badge text color.

void SBGAction::setBadgeTextColor (
    const QColor & badgeTextColor
) 


function setFavoriteFlag#

Sets the favorite flag.

void SBGAction::setFavoriteFlag (
    bool favoriteFlag
) 


function setHighlightedNode#

Sets the highlighted node.

void SBGAction::setHighlightedNode (
    SBNode * highlightedNode
) 


function setHighlightingFlag#

Sets the highlighting flag.

void SBGAction::setHighlightingFlag (
    bool highlightingFlag
) 


function setIconFilename#

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

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


function setIconPathname#

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

void SBGAction::setIconPathname (
    const QString & filename
) 


function setIconPixmap#

Define icon based on a given pixmap.

void SBGAction::setIconPixmap (
    const QPixmap & pixmap
) 


function ~SBGAction#

Destructor.

virtual SBGAction::~SBGAction () 


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
) 


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
) 


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