PyQt5 QTableView设置某一列不可编辑的方法
作者:油炸板蓝根 时间:2023-12-04 06:34:45
如下所示:
class EmptyDelegate(QItemDelegate):
def __init__(self,parent):
super(EmptyDelegate, self).__init__(parent)
def createEditor(self, QWidget, QStyleOptionViewItem, QModelIndex):
return None
写一个代理。
self.tableView.setItemDelegateForColumn(2,EmptyDelegate(self)) # 设置第二列不可编辑
设置一下就可以了。
来源:https://blog.csdn.net/qq_37660755/article/details/85596997
标签:PyQt5,QTableView,编辑
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python实现小世界网络生成
2022-07-22 07:54:46
![](https://img.aspxhome.com/file/2023/7/112927_0s.jpg)
python中get和post有什么区别
2022-04-17 16:45:15
Python新手入门之解释器的安装
2023-02-14 15:41:52
![](https://img.aspxhome.com/file/2023/7/133367_0s.png)
sqlserver连接错误之SQL评估期已过的问题解决
2024-01-14 07:25:27
![](https://img.aspxhome.com/file/2023/2/124852_0s.png)
一个无组件上传的ASP代码
2007-10-09 19:49:00
vue router路由嵌套不显示问题的解决方法
2024-04-09 10:58:18
![](https://img.aspxhome.com/file/2023/9/139729_0s.jpg)
使用递归算法结合数据库解析成Java树形结构的代码解析
2024-01-18 00:11:33
Python pip替换为阿里源的方法步骤
2023-07-19 15:39:23
![](https://img.aspxhome.com/file/2023/8/118078_0s.png)
Tensorflow的DataSet的使用详解
2021-03-19 18:18:04
Python编程实现凯撒密码加密示例
2021-04-22 01:58:56
Oracle存储过程之数据库中获取数据实例
2009-03-04 10:57:00
Pycharm cannot set up a python SDK问题的原因及解决方法
2022-12-21 15:05:34
![](https://img.aspxhome.com/file/2023/0/100760_0s.jpg)
Python中__slots__属性介绍与基本使用方法
2023-11-22 02:45:59
使用Python-pptx 告别繁琐的幻灯片制作
2021-12-10 12:03:23
![](https://img.aspxhome.com/file/2023/4/133724_0s.png)
基于python解线性矩阵方程(numpy中的matrix类)
2023-11-03 06:54:12
Vue设置浏览器小图标(ICON)的详细步骤
2024-05-05 09:06:35
![](https://img.aspxhome.com/file/2023/2/130852_0s.jpg)
Python爬虫实现抓取电影网站信息并入库
2023-12-25 02:42:32
![](https://img.aspxhome.com/file/2023/8/77658_0s.png)
Python 实用技巧之利用Shell通配符做字符串匹配
2021-07-18 22:57:16
pytorch和numpy默认浮点类型位数详解
2021-11-10 10:19:49
第一类工厂与哈希对象
2009-12-28 13:14:00