本页内容

委托控件

Qt Quick Controls 提供了一系列可在视图中用作委托控件的控件。

CheckDelegate

带复选标记的项目委托控件,该标记可切换为开启或关闭状态

HorizontalHeaderViewDelegate

ItemDelegate

可在各种视图和控件中使用的基本项目委托控件

RadioDelegate

带单选指示器的排他性项目委托控件,该指示器可切换为开启或关闭状态

SwipeDelegate

可滑动项目委托控件

SwitchDelegate

带开关指示器的项目委托,该指示器可开启或关闭

TableViewDelegate

可分配给 TableView 的委托

TreeViewDelegate

可分配给 TreeView 的委托

VerticalHeaderViewDelegate

每种类型的委托都有其特定的目标用例。以下各节将根据具体用例,提供选择合适委托类型的指导原则。

CheckDelegate 控件

CheckDelegate 提供了一个可选中控件,可将其切换为选中(启用)或未选中(禁用)状态。复选框委托通常用于从一组选项中选择一个或多个选项。

另请参阅 “复选框控件”。

ItemDelegate 控件

ItemDelegate 提供了一个可选中控件,用户可以按下或单击该控件。

单选按钮控件

RadioDelegate 提供了一个可选中控件,可切换为“选中”或“未选中”状态。单选控件通常用于从一组选项中选择一个选项。

另请参阅 RadioButton 控件。

SwipeDelegate 控件

SwipeDelegate 提供了一个视图项,用户可以向左或向右滑动以显示更多选项或信息。

SwitchDelegate 控件

SwitchDelegate 提供了一个可切换的委托,可将其开启或关闭。

另请参阅 Switch 控件。

TableViewDelegate 控件

显示包含内容的单元格的表格视图委托

TableViewDelegate 是一种委托,可分配给TableView 的delegate 属性。

另请参阅 TableView

TreeViewDelegate 控件

显示分层项目的树形视图委托

TreeViewDelegate 是一种可分配给TreeView 的 delegate 属性的委托。

另请参阅 TreeView 。

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