ActionContainer Class

class Core::ActionContainer

The ActionContainer class represents a menu or menu bar in Qt Creator. More...

Header: #include <coreplugin/actionmanager/actioncontainer.h>
Inherits: QObject

Public Types

enum OnAllDisabledBehavior { Disable, Hide, Show }

Detailed Description

You don't create instances of this class directly, but instead use the ActionManager::createMenu(), ActionManager::createMenuBar() and ActionManager::createTouchBar() functions. Retrieve existing action containers for an ID with ActionManager::actionContainer().

Within a menu or menu bar you can group menus and items together by defining groups (the order of the groups is defined by the order of the ActionContainer::appendGroup() calls), and adding menus or actions to these groups. If no custom groups are defined, an action container has three default groups Core::Constants::G_DEFAULT_ONE, Core::Constants::G_DEFAULT_TWO and Core::Constants::G_DEFAULT_THREE.

You can specify whether the menu represented by this action container should be automatically disabled or hidden whenever it only contains disabled items and submenus by setting the corresponding setOnAllDisabledBehavior(). The default is ActionContainer::Disable for menus, and ActionContainer::Show for menu bars.

Member Type Documentation

enum ActionContainer::OnAllDisabledBehavior

Defines what happens when the represented menu is empty or contains only disabled or invisible items.

ConstantValueDescription
Core::ActionContainer::Disable0The menu will be visible but disabled.
Core::ActionContainer::Hide1The menu will not be visible until the state of the subitems changes.
Core::ActionContainer::Show2The menu will still be visible and active.