enum Qt::ItemDataRole

Each item in the model has a set of data elements associated with it, each with its own role. The roles are used by the view to indicate to the model which type of data it needs. Custom models should return data in these types.

model中的每个item项都有相关联的数据元素,都有自己的role,这些roles被用于view需要那种类型的model。自定义的model需要返回这些类型的数据。
通用的roles和相关联的种类

Constant          Value Description
Qt::DisplayRole     0   The key data to be rendered in the form of text.
                        数据以文本形式出现. (QString)
Qt::DecorationRole  1   The data to be rendered as a decoration in the form of an icon. 
                        数据作为图标出现(QColor, QIcon or QPixmap)                                                                   
Qt::EditRole        2   The data in a form suitable for editing in an editor. 
                        表单中的数据适合在编辑器中编辑(QString)
Qt::ToolTipRole     3   The data displayed in the item's tooltip. 
                        数据显示Item提示(QString)
Qt::StatusTipRole   4   The data displayed in the status bar.
                        数据现在在 status bar中 (QString)
Qt::WhatsThisRole   5   The data displayed for the item in "What's This?" mode. 
                        数据显示在"What's This?"mode中(QString)
Qt::SizeHintRole    13  The size hint for the item that will be supplied to views. 
                        项的大小提供给Views。   

这里写图片描述

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值