[PyQt] Problem with destroyed() signal and QMainWindow

dizou di_zou at yahoo.com
Wed Aug 18 19:02:22 BST 2010



Colin McPhail-2 wrote:
> 
> 
> Does adding the line    self.setAttribute(Wt.WA_DeleteOnClose)   to
> DrawWindow's __init__ method help?
> 
> -- Colin
> 
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> 
> 

That didn't work, but this is what I ended up doing and this does what I
want it to do:

 class MainWindow(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)
    def EnterDrawMode(self):
        drawWindow = DrawWindow(self)
        drawWindow.show()
        self.connect(drawWindow, SIGNAL("exitDrawMode()"), self.Test)
    def Test(self):
        print "exit"
        #do stuff
 
 class DrawWindow(QMainWindow):
    def __init__(self, parent):
        QMainWindow.__init__(self, parent)
        self.setObjectName("DrawWindow")
        self.setFixedSize(200, 200)
     def closeEvent(self, event):
        self.emit(SIGNAL("exitDrawMode()"))
        event.accept()

-- 
View this message in context: http://old.nabble.com/Problem-with-destroyed%28%29-signal-and-QMainWindow-tp29472790p29474283.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list