Class sh::actions::AbstractActionItem¶
-
class
sh::actions
::
AbstractActionItem
: public QObject, public std::enable_shared_from_this<AbstractActionItem>¶ Abstract base class for executable actions, submenus of them, and more.
See the subclasses of this class.
They are used at various places. The toolbar and context menus provide them to the user.
They can be registered e.g. in a sh::actions::ActionFactory or returned from sh::filesystem::FilesystemHandler.getActions in order to make them available.
Subclassed by sh::actions::ActionActionItem, sh::actions::HeaderActionItem, sh::actions::SeparatorActionItem, sh::actions::SubmenuActionItem
Public Functions
-
QString
text
()¶ Returns the displayed text for this action.
-
QString
icon
()¶ Returns the icon for this action.
-
bool
enabled
()¶ Checks if this action is enabled.
-
bool
isChecked
()¶ Checks if this action is checked (has a cross in the ui).
-
bool
isCheckable
()¶ Checks if this action is checkable (can have a cross in the ui).
-
int
defaultActionPrecedence
() const¶ Returns the precedence for becoming the default action of a parent submenu.
This e.g. leads to a bold label.
The action with the highest value becomes the default. Only values >0 will be considered. See ActionDefaultPrecedenceValues for reference values.
-
void
setText
(QString text)¶ Sets the displayed text.
-
void
setIcon
(QString icon)¶ Sets the icon.
-
void
setEnabled
(bool enabled)¶ Sets if the item is enabled.
-
void
setChecked
(bool checked)¶ Sets if the item is checked (has a cross in the ui).
-
void
setVisible
(bool visible)¶ Sets the visibility of this item.
-
bool
visible
()¶ Checks the visibility of this item (non-recursively).
-
std::weak_ptr<AbstractActionItem>
parentAction
()¶ Returns the parent action, if it is added to a container.
Sets the parent action. .
-
void
initializeAsync
(std::function<void()> oninitialized = 0)¶ Asynchonously initializes the action.
-
void
initializeSync
()¶ Synchonously initializes the action.
-
bool
isInitialized
()¶ Checks if this action is initialized.
-
bool
isInitializing
()¶ Checks if this action is initializing.
-
AbstractActionItem
()¶
Signals
-
void
changed
()¶ Emits when some data changed.
Private Members
-
QString
_text
¶
-
QString
_icon
¶
-
bool
_enabled
¶
-
bool
_visible
¶
-
bool
_ischeckable
¶
-
bool
_ischecked
¶
-
bool
_initialized
¶
-
bool
_initializing
¶
-
bool
_reinitialize
¶
-
std::weak_ptr<AbstractActionItem>
_parentAction
= NO_PARENT¶
-
int
_defaultActionPrecedence
¶
Private Static Attributes
-
QWaitCondition
initcondition
¶
-
QString