ModeManager Class | Extending Qt Creator Manual
Description: The ModeManager class manages the activation of modes and the actions in the mode selector's tool bar.

- Extending Qt Creator Manual
- QtCreator
- ModeManager
- Extending Qt Creator Manual 15.0.0

# ModeManager Class

class Core::ModeManager

The ModeManager class manages the activation of modes and the actions in the mode selector's tool bar. More...

Header: | `#include <coreplugin/modemanager.h>`
Inherits: | QObject

- List of all members, including inherited members

## Signals

void | currentModeAboutToChange(Utils::Id mode)
void | currentModeChanged(Utils::Id mode, Utils::Id oldMode = {})

## Static Public Members

void | activateMode(Utils::Id id)
void | addAction(QAction *action, int priority)
Core::IMode * | currentMode()
Utils::Id | currentModeId()
Core::ModeManager * | instance()

## Detailed Description

Modes are implemented with the IMode class. Use the ModeManager to force activation of a mode, or to be notified when the active mode changed.

The ModeManager also manages the actions that are visible in the mode selector's toolbar. Adding actions to the tool bar should be done very sparingly.

## Member Function Documentation

### `[static]` void ModeManager::activateMode(Utils::Id id)

Makes the mode with ID id the current mode.

See also currentMode(), currentModeId(), currentModeAboutToChange(), and currentModeChanged().

### `[static]` void ModeManager::addAction(QAction *action, int priority)

Adds the action to the mode selector's tool bar. Actions are sorted by priority in descending order. Use this functionality very sparingly.

### `[static]` Core::IMode *ModeManager::currentMode()

Returns a pointer to the current mode.

See also activateMode() and currentModeId().

### `[signal]` void ModeManager::currentModeAboutToChange(Utils::Id mode)

Emitted before the current mode changes to mode.

### `[signal]` void ModeManager::currentModeChanged(Utils::Id mode, Utils::Id oldMode = {})

Emitted after the current mode changed from oldMode to mode.

### `[static]` Utils::Id ModeManager::currentModeId()

Returns the id of the current mode.

See also activateMode() and currentMode().

### `[static]` Core::ModeManager *ModeManager::instance()

Returns the pointer to the instance. Only use for connecting to signals.