En esta página

ItemDelegate QML Type

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

Propiedades

Descripción detallada

ItemDelegate representa un elemento de vista estándar. Se puede utilizar como delegado en diversas vistas y controles, como ListView y ComboBox.

ItemDelegate hereda su API de AbstractButton. Por ejemplo, puedes establecer text, mostrar un icono y reaccionar a clicks utilizando la API de 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 deItemDelegate y controles delegados.

Documentación de propiedades

highlighted : bool

Esta propiedad indica si el delegado está resaltado.

Se puede resaltar un delegado para llamar la atención del usuario sobre él. Esto no afecta a la interacción con el teclado. Por ejemplo, puedes resaltar el elemento actual en un « 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.