ItemDelegate QML Type
Delegado de item básico que pode ser usado em várias visualizações e controles. Mais...
| Import Statement: | import QtQuick.Controls |
| Inherits: | |
| Inherited By: | CheckDelegate, HorizontalHeaderViewDelegate, RadioDelegate, SwipeDelegate, SwitchDelegate, TableViewDelegate, TreeViewDelegate, and VerticalHeaderViewDelegate |
Propriedades
- highlighted : bool
Descrição detalhada
O ItemDelegate representa um item de visualização padrão. Ele pode ser usado como um delegado em várias visualizações e controles, como ListView e ComboBox.
O ItemDelegate herda sua API de AbstractButton. Por exemplo, você pode definir text, exibir um ícone e reagir a clicks usando a 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 { }
}Consulte também Personalização do ItemDelegate e dos controles Delegate.
Documentação de propriedades
highlighted : bool
Essa propriedade indica se o delegado está destacado.
Um delegado pode ser destacado para chamar a atenção do usuário para ele. Isso não afeta a interação com o teclado. Por exemplo, você pode destacar o item atual em um ListView usando o código a seguir:
ListView {
id: listView
model: 10
delegate: ItemDelegate {
text: index
highlighted: ListView.isCurrentItem
required property int index
onClicked: listView.currentIndex = index
}
}O valor padrão é ` 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.