Pages
API Documentation
On this page

KToolBarPopupAction Class

This action is a normal action everywhere, except in a toolbar where it also has a popupmenu (optionally delayed). More...

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

List of all members, including inherited members

Public Types

Properties

Public Functions

Detailed Description

This action is designed for history actions (back/forward, undo/redo) and for any other action that has more detail in a toolbar than in a menu (e.g. tool chooser with "Other" leading to a dialog...).

In contrast to KActionMenu, this action is a simple menuitem when plugged into a menu, and has a popup only in a toolbar.

Use cases include Back/Forward, and Undo/Redo. Simple click is what's most commonly used, and enough for menus, but in toolbars there is also an optional popup to go back N steps or undo N steps.

Note: Add actions to the popupMenu(), don't use setMenu().

Member Type Documentation

[since 6.0] enum KToolBarPopupAction::PopupMode

The menu popup mode.

Default is MenuButtonPopup.

Constant Value Description
KToolBarPopupAction::NoPopup -1 Behave as if the button had no menu.
KToolBarPopupAction::DelayedPopup QToolButton::DelayedPopup Clicking anywhere on the toolbar button triggers the default action. Clicking and holding the toolbar button opens the popup menu instead.
KToolBarPopupAction::MenuButtonPopup QToolButton::MenuButtonPopup The toolbar button is split in a main button (triggers default action) and an arrow button (opens the popup menu).
KToolBarPopupAction::InstantPopup QToolButton::InstantPopup Clicking anywhere on the toolbar button opens the popup menu.

This enum was introduced in Qt 6.0.

See also QToolButton::ToolButtonPopupMode

Property Documentation

popupMode : PopupMode

Access functions:

  • KToolBarPopupAction::PopupMode popupMode() const
  • void setPopupMode(KToolBarPopupAction::PopupMode popupMode)

Member Function Documentation

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

Create a KToolBarPopupAction, with a text, an icon, a parent and a name.

icon The icon to display.

text The text that will be displayed.

parent This action's parent.

[since 6.0] QMenu *KToolBarPopupAction::popupMenu() const

The popup menu that is shown when clicking (some time) on the toolbar button. You may want to plug items into it on creation, or connect to aboutToShow for a more dynamic menu.

Note: menu() is null on this action by default and using setMenu() will effectively turn this action into a regular action with a submenu.

This function was introduced in Qt 6.0.

[since 6.0] KToolBarPopupAction::PopupMode KToolBarPopupAction::popupMode() const

The popup mode of the toolbar button.

Note: Getter function for property popupMode.

This function was introduced in Qt 6.0.

See also setPopupMode()

[since 6.0] void KToolBarPopupAction::setPopupMode(KToolBarPopupAction::PopupMode popupMode)

Determines the popup mode of the toolbar button.

Note: Setter function for property popupMode.

This function was introduced in Qt 6.0.

See also popupMode(), PopupMode

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.