Pyqt4 MDI没有干净的mdiarea

时间:2017-03-22 19:23:25

标签: pyqt4 mdi mdichild

我是PyQt的新手,我正在开发像MDI这样的应用程序,我使用QDesigner来构建表单(我来自Visual Basic),到目前为止一直都很好,但是运行应用程序很难让我感到恐惧,当我关闭一个窗口时,擦除所有内容,但框架保留在mdi区域,单击x并关闭。我附上了代码。

有了这个我敲门窗口:

def ordentrabajo(self):

    self.cot = FichaOrdenTrabajo()
    subwindow = QtGui.QMdiSubWindow()
    self.cot.mdiarea = self.ventana.mdiArea
    subwindow.setWidget(self.cot)
    subwindow.setGeometry(0, 0, 595, 490)
    self.ventana.mdiArea.addSubWindow(subwindow)
    subwindow.showventana = self.cot.show()

在FichaOrdenTrabajo内,我关闭:

def closeEvent(self, QCloseEvent):

    self.emit(QtCore.SIGNAL('cerrar'))
    general.saveposic('ctrlordentrabajo', self.x(), self.y())
    self.subwindow.close = self.cdeta.close()
    self.cdeta.hide()
    # del self.subwindow
    self.subwindow = None

将主窗口置于此状态:

ventana principal

问题是如何在关闭mdi-area时清洁?

谢谢

0 个答案:

没有答案