如何触发 QTableView 中项目的编辑模式? [英] How to trigger the edit mode of an item in a QTableView?

查看:47
本文介绍了如何触发 QTableView 中项目的编辑模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在使用 QTableView 和 QStandardItemModel.

I'm using QTableView and QStandardItemModel now.

在 QTableView 中,如果双击一个单元格,该单元格将进入编辑模式,您可以编辑其内容.

In the QTableView, if you double-click a cell, this cell will get into edit mode and you can edit its content.

现在遇到一个问题,我想通过代码(通过命令)触发一个项目的编辑模式,我该怎么办?我在 QTableView 或 QStandardItemModel 中找不到合适的函数或插槽.我是否需要发出任何信号才能进入编辑模式?

Now I have a problem, I want to trigger the edit mode of an item by code (by command), what should I do? I cannot find proper function or slot in QTableView or QStandardItemModel. Do I need to emit any signal to get into edit mode?

如果我想知道编辑何时完成,我应该捕捉哪个信号(用户按Enter"或单击其他项目退出编辑模式)??

And which signal I should catch if I want to know when the editing is finish (user press "Enter" or click another items to leave the edit mode)??

感谢您的帮助

推荐答案

见:

void QAbstractItemView::edit ( const QModelIndex & index ) [slot]
void QAbstractItemView::closeEditor ( QWidget * editor, QAbstractItemDelegate::EndEditHint hint ) [virtual protected slot]
void QAbstractItemView::editorDestroyed ( QObject * editor )   [virtual protected slot]

这篇关于如何触发 QTableView 中项目的编辑模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆