KActionMenu Class

A KActionMenu is an action that provides a sub-menu of other actions. More...

Header: #include <KActionMenu>
CMake: find_package(KF6 REQUIRED COMPONENTS WidgetsAddons)
target_link_libraries(mytarget PRIVATE KF6::WidgetsAddons)
Inherits: QWidgetAction

Properties

  • popupMode : QToolButton::ToolButtonPopupMode

Public Functions

KActionMenu(QObject *parent)
KActionMenu(const QString &text, QObject *parent)
KActionMenu(const QIcon &icon, const QString &text, QObject *parent)
void addAction(QAction *action)
QAction *addSeparator()
void insertAction(QAction *before, QAction *action)
QAction *insertSeparator(QAction *before)
(since 5.77) QToolButton::ToolButtonPopupMode popupMode() const
void removeAction(QAction *action)
(since 5.77) void setPopupMode(QToolButton::ToolButtonPopupMode popupMode)

Detailed Description

Plugged in a popupmenu, it will create a submenu.

Plugged in a toolbar, it will create a button with a popup menu.

This is the action used by the XMLGUI since it holds other actions.

If you want a submenu for selecting one tool among many (without icons), see KSelectAction.

Property Documentation

popupMode : QToolButton::ToolButtonPopupMode

Access functions:

QToolButton::ToolButtonPopupMode popupMode() const
void setPopupMode(QToolButton::ToolButtonPopupMode popupMode)

Member Function Documentation

[explicit] KActionMenu::KActionMenu(QObject *parent)

KActionMenu::KActionMenu(const QString &text, QObject *parent)

KActionMenu::KActionMenu(const QIcon &icon, const QString &text, QObject *parent)

void KActionMenu::addAction(QAction *action)

Adds action to this KActionMenu. The KActionMenu does not take ownership of action.

QAction *KActionMenu::addSeparator()

void KActionMenu::insertAction(QAction *before, QAction *action)

QAction *KActionMenu::insertSeparator(QAction *before)

[since 5.77] QToolButton::ToolButtonPopupMode KActionMenu::popupMode() const

The currently used popup mode when plugged in a KToolBar.

Note: Getter function for property popupMode.

This function was introduced in 5.77.

See also setPopupMode().

void KActionMenu::removeAction(QAction *action)

[since 5.77] void KActionMenu::setPopupMode(QToolButton::ToolButtonPopupMode popupMode)

Determines the popup mode when plugged in a KToolBar.

Options are:

  • QToolButton::InstantPopup Clicking anywhere on the toolbar button opens the popup menu.
  • QToolButton::DelayedPopup (Default) Clicking anywhere on the toolbar button triggers the default action. Clicking and holding the toolbar button opens the popup menu instead.
  • QToolButton::MenuButtonPopup The toolbar button is split in a main button (triggers default action) and an arrow button (opens the popup menu).

Note: Setter function for property popupMode.

This function was introduced in 5.77.

See also popupMode() and QToolButton.