两个单选框不能同时选是

GPS平台、网站建设、软件开发、系统运维,找森大网络科技!
http://cnsendnet.taobao.com
来自森大科技官方博客
http://www.cnsendblog.com/index.php/?p=794

在这里插入图片描述
是否可分配单选列表控件的单击事件处理方法是rblISDistribution_chage(this),我们如何在这个方法里获得该单选列表控件选中的值呢?我们如果用KaTeX parse error: Expected 'EOF', got '#' at position 3: (“#̲rblISDistributi…(“#rblISDistribution”)选择器的话,获取到的是,在以下这个方法里,实参this是代表rblIsDistribution这个单选列表控件,我们通过调试JS,可以获得形参rbl的innerHTML如上图所示。
在这里插入图片描述
补充说明:其实不用加parentNode,如下所示objRadioList就是table
在这里插入图片描述
如上所示的代码,rbl.parentNode表示的Html代码如下:
在这里插入图片描述
$(“input📻checked”,rbl.parentNode)表示到这个

里面去找type为radio的标签,而且是选中的单选按钮。获取到标签后,取选中的值。
( “ i n p u t [ t y p e = r a d i o ] ” , (“input[type=radio]”, (input[type=radio],(“#rblIsPublic”))表示去id为rblIsPublic的
里去找radio标签,里面有两个,因此 ( “ i n p u t [ t y p e = r a d i o ] ” , (“input[type=radio]”, (input[type=radio],(“#rblIsPublic”)).get(1)表示第2个。

GPS平台、网站建设、软件开发、系统运维,找森大网络科技!
http://cnsendnet.taobao.com
来自森大科技官方博客
http://www.cnsendblog.com/index.php/?p=794

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在QTableView中添加单选框和复选框,您需要使用QItemDelegate类和setIndexWidget函数。以下是一个简单的示例: ```python from PyQt5.QtWidgets import QTableView, QItemDelegate, QRadioButton, QCheckBox class RadioButtonDelegate(QItemDelegate): def createEditor(self, parent, option, index): editor = QRadioButton(parent) editor.setChecked(index.data() == True) return editor def setEditorData(self, editor, index): editor.setChecked(index.data() == True) def setModelData(self, editor, model, index): model.setData(index, editor.isChecked(), role=QtCore.Qt.EditRole) class CheckBoxDelegate(QItemDelegate): def createEditor(self, parent, option, index): editor = QCheckBox(parent) editor.setChecked(index.data() == True) return editor def setEditorData(self, editor, index): editor.setChecked(index.data() == True) def setModelData(self, editor, model, index): model.setData(index, editor.isChecked(), role=QtCore.Qt.EditRole) ``` 我们创建了两个代理类:一个RadioButtonDelegate用于单选框,一个CheckBoxDelegate用于复选框。createEditor函数用于创建编辑器,setEditorData用于设置编辑器的当前值,setModelData用于将编辑器的值设置回模型中。 然后,您可以将这些代理分配给特定的列: ```python radio_delegate = RadioButtonDelegate() check_delegate = CheckBoxDelegate() table_view.setItemDelegateForColumn(1, radio_delegate) table_view.setItemDelegateForColumn(2, check_delegate) ``` 这将使第2列显示为单选框,第3列显示为复选框。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值