ItemDelegate QML Type
Élément de base pouvant être utilisé dans diverses vues et différents contrôles. En savoir plus...
| Import Statement: | import QtQuick.Controls |
| Inherits: | |
| Inherited By: | CheckDelegate, HorizontalHeaderViewDelegate, RadioDelegate, SwipeDelegate, SwitchDelegate, TableViewDelegate, TreeViewDelegate, and VerticalHeaderViewDelegate |
Propriétés
- highlighted : bool
Description détaillée
ItemDelegate représente un élément de vue standard. Il peut être utilisé comme délégué dans diverses vues et divers contrôles, tels que ListView et ComboBox.
ItemDelegate hérite de son API de AbstractButton. Par exemple, vous pouvez définir text, afficher une icône et réagir à clicks à l'aide de l'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 { }
}Voir également Personnalisation d’ItemDelegate et des contrôles délégués.
Documentation sur les propriétés
highlighted : bool
Cette propriété indique si le délégué est mis en évidence.
Un délégué peut être mis en surbrillance afin d’attirer l’attention de l’utilisateur sur celui-ci. Cela n’a aucun effet sur l’interaction au clavier. Par exemple, vous pouvez mettre en surbrillance l’élément actuel dans une liste de type « ListView » à l’aide du code suivant :
ListView {
id: listView
model: 10
delegate: ItemDelegate {
text: index
highlighted: ListView.isCurrentItem
required property int index
onClicked: listView.currentIndex = index
}
}La valeur par défaut est « 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.