网站编辑怎么做,wordpress接入qq登录,电商网站的内容设计,商城网站的功能# 向下拉框中添加选型#xff0c;具体为在下拉框第index1个选型设置为内容name
self.comboBox.addItem(name,index1) # 将下拉框中所有的选项删除
self.comboBox.clear() # 根据索引获取当前的下拉框内容
index self.comboBox.currentIndex()
text self.comboBox.itemText(i… # 向下拉框中添加选型具体为在下拉框第index1个选型设置为内容name
self.comboBox.addItem(name,index1) # 将下拉框中所有的选项删除
self.comboBox.clear() # 根据索引获取当前的下拉框内容
index self.comboBox.currentIndex()
text self.comboBox.itemText(index)# 下拉框自带的信号——currentIndexChanged self.comboBox.currentIndexChanged.connect(self.indexChange) 其中self.indexChange是自定义的槽函数即事件当下拉框中的索引项发生改变时就会触发信号【currentIndexChanged】进而会执行槽函数【self.indexChange】 实例 如上所述有下拉框有多个姓名默认显示为下拉框的第一项即index0其中每个姓名都有一个数字对应着现在需要做的是当选择不同的人时自动将对应的数字在label中显示出来这时候就使用到了currentIndexChanged信号部分代码如下 def indexChange(self):try:if self.comboBox.currentIndex() None or self.comboBox.currentIndex() 0:self.label_3.setText(str(0))else:self.label_3.setText(str(self.name_money[self.comboBox.itemText(self.comboBox.currentIndex())]))except Exception as e:passdef run(self):self.pushButton.clicked.connect(self.searchPeople_)self.comboBox.currentIndexChanged.connect(self.indexChange) 其他常用属性 参考
PyQt5基本控件详解之QComboBox(九)_jia666666的博客-CSDN博客https://blog.csdn.net/jia666666/article/details/81534260