本页内容

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 属性(因此仅有一列)的模型,该属性应被视为索引,并设置为所需的索引值。

注意: 同时设置 row 和 index 会导致行为未定义。二者等价,应仅使用其中之一。

另请参阅 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.