本页内容

Core::Context Class

class Core::Context

Context 类实现了一组上下文 ID。更多内容...

Header: #include <coreplugin/icontext.h>

公共类型

公共函数

Context()
Context(Utils::Id c1)
Context(Utils::Id c1, Utils::Id c2)
Context(Utils::Id c1, Utils::Id c2, Utils::Id c3)
void add(Utils::Id c)
void add(const Core::Context &c)
Utils::Id at(int i) const
Core::Context::const_iterator begin() const
bool contains(Utils::Id c) const
Core::Context::const_iterator end() const
int indexOf(Utils::Id c) const
bool isEmpty() const
void prepend(Utils::Id c)
void removeAt(int i)
int size() const

详细说明

上下文用于向Core::ActionManager 注册操作,以及在创建为操作提供上下文的 UI 元素时使用。

有关上下文使用方法的概述,请参阅《操作管理器和命令》。

另请参阅 Core::IContext 、Core::ActionManager 以及《操作管理器和命令》。

成员类型文档

[alias] Context::const_iterator

Context::const_iterator 为 Context 提供了一个 STL 风格的 const 迭代器。

成员函数文档

[constexpr noexcept] Context::Context()

创建一个代表全局上下文的上下文列表。

[explicit] Context::Context(Utils::Id c1)

创建一个包含单个 IDc1 的上下文列表。

Context::Context(Utils::Id c1, Utils::Id c2)

创建一个包含 ID 为c1 和c2 的上下文列表。

Context::Context(Utils::Id c1, Utils::Id c2, Utils::Id c3)

创建一个包含 IDc1 、c2 和c3 的上下文列表。

void Context::add(Utils::Id c)

将 IDc 添加到上下文列表的末尾。

void Context::add(const Core::Context &c)

将上下文列表c 添加到此上下文列表的末尾。

Utils::Id Context::at(int i) const

返回上下文列表中索引为i 的ID。

Core::Context::const_iterator Context::begin() const

返回一个指向上下文列表中第一个 ID 的 STL 风格迭代器。

bool Context::contains(Utils::Id c) const

返回此上下文列表中是否包含 IDc 。

Core::Context::const_iterator Context::end() const

返回一个 STL 风格的迭代器,该迭代器指向上下文列表中最后一个 ID 之后的虚拟项。

int Context::indexOf(Utils::Id c) const

返回 ID 为c 的项目在上下文列表中的索引位置。如果未找到匹配的项目,则返回 -1。

bool Context::isEmpty() const

返回此上下文列表是否为空,从而判断其是否为默认构造的。

void Context::prepend(Utils::Id c)

将 IDc 作为第一个项目添加到上下文列表中。

void Context::removeAt(int i)

从上下文列表中删除索引为i 的ID。

int Context::size() const

返回上下文列表中的 ID 数量。

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.