このページでは

ActionGroup QML Type

アクションをグループ化します。詳細...

Import Statement: import QtQuick.Controls
Inherits:

QtObject

プロパティ

付属物件

信号

方法

詳細説明

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も参照してください

プロパティのドキュメント

actions : list<Action> [default]

このプロパティはグループ内のアクションのリストを保持する。

groupも参照してください

checkedAction : Action

このプロパティは、排他的グループで現在選択されているアクションを保持し、存在しないかグループが非排他的である場合はnull

デフォルトでは、排他的アクショングループに追加された最初のチェックされたアクションです。

exclusiveも参照してください

enabled : bool

このプロパティは、アクショングループが有効かどうかを保持する。デフォルト値はtrue である。

このプロパティがfalse の場合、グループ内のすべてのアクションは無効になる。このプロパティがtrue の場合、明示的に無効化されない限り、グループ内のすべてのアクションが有効化される。

exclusive : bool

このプロパティは、アクショングループが排他的であるかどうかを保持する。デフォルト値はtrue である。

このプロパティがtrue の場合、グループ内の1つのアクショ ンのみをいつでもチェックすることができる。ユーザは任意のアクションをトリガしてそれをチェックすることができ、そのアクションはグループ内のチェックされたアクションとして既存のアクションを置き換える。

排他的グループでは、ユーザーは現在チェックされているアクションをトリガーしてチェッ ク解除することはできない。代わりに、グループ内の別のアクションをトリガーして、そ のグループの新しいチェック済みアクションを設定しなければならない。

非排他的グループでは、アクションのチェックやチェックの解除は、グループ内の他のアクションに影響を与えない。さらに、checkedAction プロパティの値はnull です。

付属プロパティのドキュメント

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も参照

シグナルのドキュメント

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)

アクショングループにaction

注: アクション・グループにオブジェクトを手動で追加することは、通常は不要です。actions プロパティとgroup attached プロパティは、便利で宣言的な構文を提供する。

actionsgroupも参照してください

void removeAction(Action action)

アクショングループからaction

注意: アクション・グループからオブジェクトを手動で削除することは、通常は不要である。actions プロパティとgroup attached プロパティは、便利で宣言的な構文を提供する。

actions およびgroupも参照してください

© 2026 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.