EditTrigger
EditTrigger是QAbstractItemView Class的Public Function
This property holds which actions will initiate item editing
此属性保存哪些操作将启动项编辑
This property is a selection of flags defined by EditTrigger, combined using the OR operator. The view will only initiate the editing of an item if the action performed is set in this property.
此属性是由EditTrigger定义的标志的选择,并使用OR运算符组合。只有在此属性中设置了执行的操作,视图才会启动对项目的编辑。
Constant | Value | Description |
---|---|---|
QAbstractItemView::NoEditTriggers | 0 | No editing possible. |
QAbstractItemView::CurrentChanged | 1 | Editing start whenever current item changes. |
QAbstractItemView::DoubleClicked | 2 | Editing starts when an item is double clicked. |
QAbstractItemView::SelectedClicked | 4 | Editing starts when clicking on an already selected item. |
QAbstractItemView::EditKeyPressed | 8 | Editing starts when the platform edit key has been pressed over an item. |
QAbstractItemView::AnyKeyPressed | 16 | Editing starts when any key is pressed over an item. |
QAbstractItemView::AllEditTriggers | 31 | Editing starts for all above actions. |
例子:
如果想要单击开启编辑器而不是双击,则需要设置为CurrentChanged
ui->tableView->setEditTriggers(QAbstractItemView::CurrentChanged);