您的位置:首页 > 编程语言 > Qt开发

QTreeWidgetItem 点击可编辑修改

2013-08-19 22:18 330 查看

enum Qt::ItemFlag

flags Qt::ItemFlags

This enum describes the properties of an item:

ConstantValueDescription
Qt::NoItemFlags0It does not have any properties set.
Qt::ItemIsSelectable1It can be selected.
Qt::ItemIsEditable2It can be edited.
Qt::ItemIsDragEnabled4It can be dragged.
Qt::ItemIsDropEnabled8It can be used as a drop target.
Qt::ItemIsUserCheckable16It can be checked or unchecked by the user.
Qt::ItemIsEnabled32The user can interact with the item.
Qt::ItemIsTristate64The item is checkable with three separate states.
Note that checkable items need to be given both a suitable set of flags and an initial state, indicating whether the item is checked or not. This is handled automatically for model/view components, but needs to be explicitly set for instances of QListWidgetItem,QTableWidgetItem,
and QTreeWidgetItem.

The ItemFlags type is a typedef for QFlags<ItemFlag>. It stores an OR combination of ItemFlag values.

注意最后一句,ItemFlags存储的是几个ItemFlag的逻辑或的结果。

所以设置某个Item可编辑时,可以item->setFlags(Qt::ItemIsEditable |Qt::ItemIsEnabled);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐