이 페이지에서

Core::ActionBuilder Class

class Core::ActionBuilder

ActionBuilder 클래스는 Core::Command를 설정하기 위한 편의 클래스입니다. 더 보기...

Header: #include <coreplugin/actionmanager/actionmanager.h>

공개 함수

ActionBuilder(QObject *contextActionParent, const Utils::Id actionId)
~ActionBuilder()
Core::ActionBuilder &adopt(Utils::Action *action)
Core::ActionBuilder &setIconText(const QString &iconText)
Core::ActionBuilder &setText(const QString &text)

상세 설명

액션 빌더는 Core::Command 및 컨텍스트 액션의 속성을 지정하며, 소멸자에서 ActionManager::registerAction()를 사용하여 Command에 대해 설정된 Core::Context 에 대한 액션을 실제로 등록합니다.

멤버 함수 문서

ActionBuilder::ActionBuilder(QObject *contextActionParent, const Utils::Id actionId)

ID가 actionId 인 액션에 대한 액션 빌더를 생성합니다.

contextActionParent 는 내부적으로 생성된 QAction 객체의 수명을 제어하기 위해 QObject 부모를 제공하는 데 사용됩니다.

이는 일반적으로 ActionBuilder 를 사용하는 엔티티의 this 포인터입니다.

[noexcept] ActionBuilder::~ActionBuilder()

생성된 액션을 설정된 속성과 함께 등록합니다.

ActionManager::registerAction()도 참조하십시오 .

Core::ActionBuilder &ActionBuilder::adopt(Utils::Action *action)

지정된 ` action `를 이 빌더의 `contextAction`으로 사용합니다. ` action `는 `nullptr`이어서는 안 되며, ` setText()`이나 `setIcon()`과 같은 실제 속성을 설정하기 전에 `adopt()`를 호출해야 합니다.

일반적으로 contextActionParent 를 ActionBuilder 생성자에 전달하고, bindContextAction()을 사용하여 QAction 을 자동으로 생성된 컨텍스트 액션에 바인딩하는 방식을 선호해야 합니다.

이 메서드는 호출자가 액션의 수명 주기를 직접 관리하는 경우, 예를 들어 자동으로 생성된 컨텍스트 액션의 부모가 될 수 있는 QObject 가 없는 경우에 유용할 수 있습니다.

Core::ActionBuilder &ActionBuilder::setIconText(const QString &iconText)

현재 생성 중인 액션의 ` iconText ` 속성을 ` iconText`로 설정합니다.

QAction::setIconText()도 참조하십시오 .

Core::ActionBuilder &ActionBuilder::setText(const QString &text)

현재 생성 중인 액션의 ` text ` 속성을 ` text`로 설정합니다.

QAction::setText()도 참조하십시오 .

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.