このページでは

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.