En esta página

ItemDelegate QML Type

Delegado de elemento básico que se puede utilizar en varias vistas y controles. Más...

Propiedades

Descripción detallada

ItemDelegate presenta un elemento de vista estándar. Puede utilizarse como delegado en varias vistas y controles, como ListView y ComboBox.

ItemDelegate hereda su API de AbstractButton. Por ejemplo, puede configurar text, mostrar un icono y reaccionar a clicks utilizando la API AbstractButton.

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 { }
}

Véase también Personalización de ItemDelegate y Controles delegados.

Documentación de propiedades

highlighted : bool

Esta propiedad indica si el delegado está resaltado.

Un delegado puede resaltarse para atraer la atención del usuario hacia él. No tiene ningún efecto sobre la interacción con el teclado. Por ejemplo, puede resaltar el elemento actual en ListView utilizando el siguiente código:

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

        required property int index

        onClicked: listView.currentIndex = index
    }
}

El valor por defecto es 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.