IContext Class

class Core::IContext

The IContext class associates a widget with a context list and context help. More...

Header: #include <coreplugin/icontext.h>
Inherits: QObject
Inherited By:

Core::IEditor and Core::IMode

Public Types

Detailed Description

An instance of IContext must be registered with Core::ICore::addContextObject() to have an effect. For many subclasses of IContext, like Core::IEditor and Core::IMode, this is done automatically. But instances of IContext can be created manually to associate a context and context help for an arbitrary widget, too. IContext instances are automatically unregistered when they are deleted. Use Core::ICore::removeContextObject() if you need to unregister an IContext instance manually.

Whenever the widget is part of the application wide focus widget's parent chain, the associated context list is made active. This makes actions active that were registered for any of the included context IDs. If the user requests context help, the top-most IContext instance in the focus widget's parent hierarchy is asked to provide it.

See The Action Manager and Commands for an overview of how contexts are used for managing actions.

See also Core::ICore, Core::Context, Core::ActionManager, and The Action Manager and Commands.

Member Type Documentation

[alias] IContext::HelpCallback

The HelpCallback class defines the callback function that is used to report the help item to show when the user requests context help.