ToolbarAction

Qualified name: mv::gui::ToolbarAction

class ToolbarAction : public mv::gui::WidgetAction

Toolbar action class.

Base toolbar action for displaying actions

Author

Thomas Kroes

Subclassed by mv::gui::HorizontalToolbarAction, mv::gui::VerticalToolbarAction

Public Functions

Q_INVOKABLE ToolbarAction(QObject *parent, const QString &title, const Qt::AlignmentFlag &alignment = Qt::AlignmentFlag::AlignLeft)

Construct with parent and title.

Parameters:
  • parent – Pointer to parent object

  • title – Title of the action

  • alignment – Item alignment

virtual void addAction(WidgetAction *action, const std::int32_t &autoExpandPriority = -1, std::int32_t widgetFlags = -1, WidgetConfigurationFunction widgetConfigurationFunction = WidgetConfigurationFunction()) final

Add action to the group.

Parameters:
  • action – Pointer to action to add

  • autoExpandPriority – Priority with which the action should be auto-expanded

  • widgetFlags – Action widget flags (default flags if -1)

virtual void removeAction(WidgetAction *action) final

Remove action from the group.

Parameters:

action – Pointer to action to add

virtual StretchAction *addStretch(std::int32_t stretch = 1) final

Add stretch action to the group with stretch factor.

Parameters:

stretch – Stretch factor

Returns:

Pointer to stretch action (the toolbar remains the owner)

virtual WidgetActions getActions() final

Get actions.

Returns:

Vector of pointers to actions

virtual void setActionAutoExpandPriority(const WidgetAction *action, const std::int32_t &autoExpandPriority) final

Set action auto expand priority to autoExpandPriority.

Parameters:
  • action – Pointer to action for which to set the auto expand priority

  • autoExpandPriority – Priority with which the action should be auto-expanded

void actionWidgetsChanged(ActionItemsMap &actionWidgets)

Signals that the action widgets changed to actionWidgets.

Parameters:

actionWidgets – New action widgets

void layoutInvalidated()

Signals that the layout has become invalid due to changes in auto expand priorities or change in widget size.

Protected Functions

virtual GroupAction &getGroupAction() final

Get group action.

Returns:

Reference to group action

virtual ActionItems &getActionItems()

Get action items for the toolbar.

Returns:

Vector of action items

Protected Static Attributes

static constexpr std::int32_t CONTENTS_MARGIN = 4

Maps action pointer to action item pointer.