qt - How to enable edit-mode on a specific cell in a QTableWidget?
问题描述
I can go to a specific cell:
ui->tableWidget->setCurrentCell(ui->tableWidget->rowCount() - 1, 0);
But how do I put the cell into editor mode, so the user does not have to double click the cell to begin editing the contents?
解决方案
The QTableWidget
class inherits QAbstractItemView
, which has the required APIs.
You just need to get the relevant model index using currentIndex(), and then pass that to the edit() slot to put the current cell into edit-mode:
ui->tableWidget->edit(ui->tableWidget->currentIndex());
推荐阅读
- php - 读取列表并将其存储为数组
- scala - Spark:错误的时间戳解析
- flutter - 在 Flutter 中使用线条和弧线绘制自定义形状
- xcode - 没有为 Xcode 11.7 团队找到具有 App Store Connect 访问权限的帐户
- javascript - Cloud Firestore 数据查询
- azure - Azure Blob 源错误:远程服务器返回错误:(400) 错误请求
- performance - 使用 EmEditor 优化列数据中的多元素排序/去重
- mongodb - 如何从具有两个条件的数组中查询元素(MongoDB)
- python - reverse 和 reverse_lazy 的区别?
- java - 将 keycloak 与 Spring Security 集成