このページでは

ItemDelegate QML Type

さまざまなビューやコントロールで使用できる基本的なアイテムデリゲートです。詳細...

プロパティ

詳細説明

ItemDelegate は、標準的なビュー項目を表します。ListView やComboBox など、さまざまなビューやコントロールでデリゲートとして使用できます。

ItemDelegate は、AbstractButton から API を継承しています。たとえば、AbstractButton の API を使用して、text を設定したり、アイコンを表示したり、clicks への反応を行ったりすることができます。

ListView {
    id: listView
    width: 160
    height: 240

    model: Qt.fontFamilies()

    delegate: ItemDelegate {
        text: modelData
        width: listView.width
        onClicked: console.log("clicked:", modelData)

        required property string modelData
    }

    ScrollIndicator.vertical: ScrollIndicator { }
}

「ItemDelegateのカスタマイズ」および「デリゲート コントロール」も参照してください 。

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

highlighted : bool

このプロパティは、デリゲートがハイライトされているかどうかを表します。

デリゲートを強調表示することで、ユーザーの注意をそこに引き付けることができます。これはキーボード操作には影響しません。たとえば、次のコードを使用すると、ListView 内の現在の項目を強調表示できます。

ListView {
    id: listView
    model: 10
    delegate: ItemDelegate {
        text: index
        highlighted: ListView.isCurrentItem

        required property int index

        onClicked: listView.currentIndex = index
    }
}

デフォルト値は `false` です。

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