Core::ActionContainer Class
class Core::ActionContainerActionContainer 클래스는 Qt Creator 에서 메뉴 또는 메뉴 바를 나타냅니다. 더 보기...
| Header: | #include <coreplugin/actionmanager/actioncontainer.h> |
| Inherits: | QObject |
공개 유형
| enum | OnAllDisabledBehavior { Disable, Hide, Show } |
공개 함수
| virtual void | addAction(Core::Command *action, Utils::Id group = Id()) = 0 |
| virtual void | addMenu(Core::ActionContainer *before, Core::ActionContainer *menu) = 0 |
| virtual void | addMenu(Core::ActionContainer *menu, Utils::Id group = Utils::Id()) = 0 |
| Core::Command * | addSeparator(Utils::Id group = {}) |
| virtual Core::Command * | addSeparator(const Core::Context &context, Utils::Id group = {}, QAction **outSeparator = nullptr) = 0 |
| virtual void | appendGroup(Utils::Id group) = 0 |
| virtual void | clear() = 0 |
| virtual void | insertGroup(Utils::Id before, Utils::Id group) = 0 |
| virtual QAction * | insertLocation(Utils::Id group) const = 0 |
| virtual QMenu * | menu() const = 0 |
| virtual QMenuBar * | menuBar() const = 0 |
| virtual Core::ActionContainer::OnAllDisabledBehavior | onAllDisabledBehavior() const = 0 |
| virtual void | setOnAllDisabledBehavior(Core::ActionContainer::OnAllDisabledBehavior behavior) = 0 |
| virtual Utils::TouchBar * | touchBar() const = 0 |
상세 설명
이 클래스의 인스턴스는 직접 생성하지 않고, 대신 ActionManager::createMenu(), ActionManager::createMenuBar() 및 ActionManager::createTouchBar() 함수를 사용합니다. ActionManager::actionContainer()을 사용하여 ID에 해당하는 기존 액션 컨테이너를 검색할 수 있습니다.
메뉴나 메뉴 바 내에서 그룹을 정의하고(그룹의 순서는 ActionContainer::appendGroup() 호출 순서에 따라 결정됨), 이 그룹들에 메뉴나 액션을 추가하여 메뉴와 항목을 그룹화할 수 있습니다. 사용자 정의 그룹이 정의되지 않은 경우, 액션 컨테이너에는 Core::Constants::G_DEFAULT_ONE, Core::Constants::G_DEFAULT_TWO, Core::Constants::G_DEFAULT_THREE 라는 세 개의 기본 그룹이 있습니다.
해당 액션 컨테이너가 비활성화된 항목과 하위 메뉴만 포함할 경우, 이 액션 컨테이너가 나타내는 메뉴를 자동으로 비활성화하거나 숨길지 여부를 해당 setOnAllDisabledBehavior()을 설정하여 지정할 수 있습니다. 기본값은 메뉴의 경우 ActionContainer::Disable 이며, 메뉴 바의 경우 ActionContainer::Show 입니다.
멤버 유형 설명서
enum ActionContainer::OnAllDisabledBehavior
표시된 메뉴가 비어 있거나, 비활성화된 항목이나 보이지 않는 항목만 포함된 경우 어떻게 처리될지 정의합니다.
| 상수 | 값 | 설명 |
|---|---|---|
Core::ActionContainer::Disable | 0 | 메뉴는 표시되지만 비활성화됩니다. |
Core::ActionContainer::Hide | 1 | 하위 항목의 상태가 변경될 때까지 메뉴가 표시되지 않습니다. |
Core::ActionContainer::Show | 2 | 메뉴는 계속 표시되며 활성화 상태입니다. |
멤버 함수 문서
[pure virtual] void ActionContainer::addAction(Core::Command *action, Utils::Id group = Id())
이 액션 컨테이너에 ‘ action ’을 메뉴 항목으로 추가합니다. 이 액션은 지정된 group 의 마지막 항목으로 추가됩니다.
appendGroup() 및 addMenu()도 참조하십시오 .
[pure virtual] void ActionContainer::addMenu(Core::ActionContainer *before, Core::ActionContainer *menu)
before 에서 지정한 메뉴 바로 앞에, 이 액션 컨테이너에 ‘ menu ’을 하위 메뉴로 추가합니다.
appendGroup() 및 addAction()도 참조하십시오 .
[pure virtual] void ActionContainer::addMenu(Core::ActionContainer *menu, Utils::Id group = Utils::Id())
이 액션 컨테이너에 ‘ menu ’를 하위 메뉴로 추가합니다. 이 메뉴는 지정된 ‘ group ’의 마지막 항목으로 추가됩니다.
appendGroup() 및 addAction()도 참조하십시오 .
Core::Command *ActionContainer::addSeparator(Utils::Id group = {})
액션 컨테이너의 ` group ` 끝에 구분자를 추가합니다.
생성된 구분자를 반환합니다.
[pure virtual] Core::Command *ActionContainer::addSeparator(const Core::Context &context, Utils::Id group = {}, QAction **outSeparator = nullptr)
지정된 group 의 끝에 구분자를 추가하여, 지정된 context 에 대해 활성화된 액션 컨테이너에 추가합니다. 생성된 구분자 액션( outSeparator)을 반환합니다.
[pure virtual] void ActionContainer::appendGroup(Utils::Id group)
액션 컨테이너에 ‘ group ’을 추가합니다.
그룹을 사용하여 액션 컨테이너를 논리적인 부분으로 나눌 수 있습니다. 액션과 메뉴를 그룹에 직접 추가할 수 있습니다.
addAction() 및 addMenu()도 참조하십시오 .
[pure virtual] void ActionContainer::clear()
이 메뉴와 하위 메뉴를 모든 작업 및 하위 메뉴에서 제거합니다. 단, 하위 메뉴와 명령 자체를 삭제하는 것이 아니라 상위 메뉴에서 제거할 뿐입니다.
[pure virtual] void ActionContainer::insertGroup(Utils::Id before, Utils::Id group)
before 로 지정된 그룹 바로 앞에 group 를 액션 컨테이너에 삽입합니다.
[pure virtual] QAction *ActionContainer::insertLocation(Utils::Id group) const
group 을 나타내는 액션을 반환하며, 이 액션은 QWidget::insertAction 와 함께 사용할 수 있습니다.
[pure virtual] QMenu *ActionContainer::menu() const
이 액션 컨테이너가 나타내는 ` QMenu ` 인스턴스를 반환하거나, 이 액션 컨테이너가 메뉴 막대를 나타내는 경우 0을 반환합니다.
[pure virtual] QMenuBar *ActionContainer::menuBar() const
이 액션 컨테이너가 나타내는 ` QMenuBar ` 인스턴스를 반환하거나, 이 액션 컨테이너가 메뉴를 나타내는 경우 0을 반환합니다.
[pure virtual] Core::ActionContainer::OnAllDisabledBehavior ActionContainer::onAllDisabledBehavior() const
이 액션 컨테이너가 비활성화된 항목과 하위 메뉴만 포함하는 경우, 해당 컨테이너가 나타내는 메뉴의 동작을 반환합니다. 기본값은 메뉴의 경우 ActionContainer::Disable 이며, 메뉴 바의 경우 ActionContainer::Show 입니다.
OnAllDisabledBehavior 및 setOnAllDisabledBehavior()도 참조하십시오 .
[pure virtual] void ActionContainer::setOnAllDisabledBehavior(Core::ActionContainer::OnAllDisabledBehavior behavior)
이 액션 컨테이너가 비활성화된 항목과 하위 메뉴만 포함하는 경우, 해당 컨테이너가 나타내는 메뉴의 ‘ behavior ’을 정의합니다. 기본값은 메뉴의 경우 ActionContainer::Disable 이며, 메뉴 바의 경우 ActionContainer::Show 입니다.
ActionContainer::OnAllDisabledBehavior 및 ActionContainer::onAllDisabledBehavior()도 참조하십시오 .
[pure virtual] Utils::TouchBar *ActionContainer::touchBar() const
이 액션 컨테이너가 나타내는 터치 바를 반환합니다.
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.