Pythone中pyqt5动态改变表格时遇到setCellWidget窗体就自动闪退
参数等等都没问题,后期改动想在tableWidget里面加个超链接,结果一加就蹦就闪退。
求大神帮忙看看是怎么回事
问题代码:
self.tableWidget.setItem(row, 0, dl)
self.tableWidget.setCellWidget(row, 1,label)
self.tableWidget.setItem(row, 2, cfd)
原代码:
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'untitled.ui'
#
# Created by: PyQt5 UI code generator 5.15.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
i = 0
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(789, 654)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(30, 10, 81, 31))
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(14)
self.label_2.setFont(font)
self.label_2.setObjectName("label_2"