def GenerateBtn(self,pid):
viewBtn = QtWidgets.QPushButton('查看')
viewBtn.setStyleSheet(''' text-align : center;
background-color : DarkSeaGreen;
height : 30px;
border-style: outset;
color:white;
font : 13px; ''')
viewBtn.clicked.connect(lambda:self.jump(pid))
return viewBtn
def jump(self,pid):
if id:
self.son.pid=pid
if not self.window.isVisible():
self.son.window.hide()
self.window.show()
else:
self.window.hide()
self.son.window.show()
self.sql.log(4,self.guige, pid)
self.son.accept()
def buttonForRow(self,res):
# 列表控件QTableWidget生成列表
self.result_list.clear()#result_list就是Qtablewidget
for i in range(0,len(res)):
item =self.result_list.horizontalHeaderItem(i)
self.result_list.setHorizontalHeaderItem(i, item)
self.result_list.setItem(i,0,QtWidgets.QTableWidgetItem(str(res[i][0])))
self.result_list.setItem(i,1, QtWidgets.QTableWidgetItem(str(res[i][1])))
btn=self.GenerateBtn(res[i][1])
self.result_list.setCellWidget(i,2,btn)
网友评论