ItemDelegate QML Type
Delegato di base utilizzabile in varie viste e controlli. Altro...
| Import Statement: | import QtQuick.Controls |
| Inherits: | |
| Inherited By: | CheckDelegate, HorizontalHeaderViewDelegate, RadioDelegate, SwipeDelegate, SwitchDelegate, TableViewDelegate, TreeViewDelegate, and VerticalHeaderViewDelegate |
Proprietà
- highlighted : bool
Descrizione dettagliata
ItemDelegate rappresenta un elemento di visualizzazione standard. Può essere utilizzato come delegato in varie viste e controlli, quali ListView e ComboBox.
ItemDelegate eredita la propria API da AbstractButton. Ad esempio, è possibile impostare text, visualizzare un'icona e reagire a clicks utilizzando 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 { }
}Vedere anche Personalizzazione di ItemDelegate e dei controlli Delegate.
Documentazione sulle proprietà
highlighted : bool
Questa proprietà indica se il delegato è evidenziato.
È possibile evidenziare un delegato per attirare l'attenzione dell'utente su di esso. Ciò non ha alcun effetto sull'interazione con la tastiera. Ad esempio, è possibile evidenziare l'elemento corrente in una ListView utilizzando il codice seguente:
ListView {
id: listView
model: 10
delegate: ItemDelegate {
text: index
highlighted: ListView.isCurrentItem
required property int index
onClicked: listView.currentIndex = index
}
}Il valore predefinito è 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.