在本页

DelegateChoice QML Type

封装委托以及何时使用委托。更多

Import Statement: import QtQml.Models
Since: Qt 6.9

属性

详细说明

DelegateChoice 类型封装了一个委托,并定义了在何种情况下应选择该委托。

DelegateChoices 可以嵌套在DelegateChooser 中。

另请参阅 DelegateChooser

属性文档

column : int

此属性包含用于匹配模型元素列值的值。

delegate : Component

如果该选择与模型项匹配,该属性将保存要使用的委托。

index : int

该属性包含用于匹配模型元素索引值的值。这实际上是row 的别名。

另请参见 row

roleValue : variant

该属性包含用于与DelegateChooser::role 提供的角色数据相匹配的值。

row : int

此属性保存用于匹配模型元素行值的值。对于只有索引属性(因此只有一列)的模型,此属性应作为索引,并设置为所需的索引值。

注意: 同时设置行和索引会产生未定义的行为。这两个属性是等价的,只能使用其中一个。

另请参见 index

© 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.