当pyqt 信号槽accept出错,显示Dialog没有"accept"时,解决办法

Dialog窗口下面的那个确定取消按钮总是出错,

这部分内容转换成py文件之后是:


QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), C2_Dialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), C2_Dialog.reject)

此时会出现错误。

修改为:

QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), self, QtCore.SLOT('accept()')) 
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), self, QtCore.SLOT('reject()'))


你可能感兴趣的:(pyqt)