我有两个文件:qdialog1.py
和qdialog2.py
当qdialog2
被拒绝时,我需要从qdialog1
qdialog1
是父级,qdialog2
是其子级
qdialog1.py
from PyQt4.QtCore import pyqtSignature
from PyQt4.QtGui import QDialog
from Ui_dialog1 import Ui_dialog1
from qdialog2 import Qdialog2
class QDialog1(QDialog, Ui_dialog1):
def __init__(self, parent=None):
QDialog.__init__(self, parent)
self.setupUi(self)
@pyqtSignature("")
def on_pbUpdate_clicked(self):
dlg = QDialog2(self)
dlg.setModal(True)
dlg.show()
def myfunction(self):
self.lineedit.clear()
qdialog2.py
from PyQt4.QtCore import pyqtSignature
from PyQt4.QtGui import QDialog
from Ui_dialog2 import Ui_dialog2
class QDialog2(QDialog, Ui_dialog2):
def __init__(self, parent=None):
QDialog.__init__(self, parent)
self.setupUi(self)
self.rejected.connect() # I need help here to call qdialog1.myfunction()
答案 0 :(得分:0)
您必须通过父
连接self.rejected.connect(parent.myfunction)