ActionGroup QML Type
アクションをグループ化します。詳細...
Import Statement: | import QtQuick.Controls |
Inherits: |
プロパティ
- actions : list<Action>
- checkedAction : Action
- enabled : bool
- exclusive : bool
付属物件
- group : ActionGroup
信号
- triggered(Action action)
方法
- void addAction(Action action)
- void removeAction(Action action)
詳細説明
ActionGroup は、アクションの視覚的でないグループです。相互exclusive アクショングループは、一度に1つのオプションしか選択できないアクションで使用されます。
ActionGroupを使用する最も簡単な方法は、グループの子としてアクションを宣言することです。
ActionGroup { id: alignmentGroup Action { checked: true checkable: true text: qsTr("Left") } Action { checkable: true text: qsTr("Center") } Action { checkable: true text: qsTr("Right") } }
あるいは、group attached プロパティによって、アクションを別の場所で宣言し、特定のグループに割り当てることもできます。
ActionGroup { id: alignmentGroup } Action { checked: true checkable: true text: qsTr("Left") ActionGroup.group: alignmentGroup } Action { checkable: true text: qsTr("Center") ActionGroup.group: alignmentGroup } Action { checkable: true text: qsTr("Right") ActionGroup.group: alignmentGroup }
より高度な使用例は、addAction()
とremoveAction()
メソッドを使用して処理できます。
Action およびButtonGroupも参照してください 。
プロパティ Documentation
checkedAction : Action |
このプロパティは、排他的グループ内で現在選択されているアクションを保持し、1つもない場合やグループが非排他的である場合はnull
を保持します。
デフォルトでは、排他的アクショングループに追加された最初のチェックされたアクションです。
exclusiveも参照のこと 。
enabled : bool |
このプロパティは、アクショングループが有効かどうかを保持する。デフォルト値はtrue
である。
このプロパティがfalse
の場合、グループ内のすべてのアクションは無効である。このプロパティがtrue
の場合、明示的に無効化されない限り、グループ内のすべてのアクションが有効化される。
exclusive : bool |
このプロパティは、アクショングループが排他的であるかどうかを保持する。デフォルト値はtrue
である。
このプロパティがtrue
の場合、グループ内の1つのアクションのみが常にチェック可能である。ユーザは任意のアクションをトリガしてそれをチェックすることができ、そのアクションはグループ内のチェックされたアクションとして既存のアクションを置き換える。
排他的グループでは、ユーザーは現在チェックされているアクションをトリガーしてチェッ ク解除することはできない。代わりに、グループ内の別のアクションをトリガーして、そ のグループの新しいチェック済みアクションを設定しなければならない。
非排他的グループでは、アクションのチェックやチェックの解除は、グループ内の他のアクションに影響を与えない。さらに、checkedAction プロパティの値はnull
です。
Attached プロパティの説明
ActionGroup.group : ActionGroup |
このプロパティは、アクションをアクショングループにアタッチします。
ActionGroup { id: group } Action { checked: true text: qsTr("Option A") ActionGroup.group: group } Action { text: qsTr("Option B") ActionGroup.group: group }
actionsも参照してください 。
Signal ドキュメンテーション
triggered(Action action) |
このシグナルは、グループ内のaction がトリガーされたときに発せられます。
このシグナルは、同じグループ内のすべてのアクションに共通のシグナルハンドラを実装するのに便利です。
ActionGroup { onTriggered: console.log("triggered:", action.text) Action { text: "First" } Action { text: "Second" } Action { text: "Third" } }
注意: 対応するハンドラはonTriggered
。
Action::triggered()も参照してください 。
メソッドの説明
void addAction(Action action) |
void removeAction(Action action) |
© 2025 The Qt Company Ltd. 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.