このページでは

ItemDelegate QML Type

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

プロパティ

詳細説明

ItemDelegateは標準的なビューアイテムを提示する。これは、ListViewComboBox のような様々なビューやコントロールでデリゲートとして使用することができます。

ItemDelegate は、その API をAbstractButton から継承しています。例えば、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と Delegateコントロールのカスタマイズも参照してください

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

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.